Const correctness, override keyword, a bunch of stuff..

This commit is contained in:
Murat 2020-08-08 23:12:43 +02:00
parent 4099d12d9a
commit 4a688b932a
144 changed files with 622 additions and 566 deletions

View File

@ -25,7 +25,7 @@ namespace hyperion
Q_OBJECT
public:
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
~BlackBorderProcessor();
~BlackBorderProcessor() override;
///
/// Return the current (detected) border
/// @return The current border

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:
///

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, 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; }
quint16 getPort() const { 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

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

@ -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; }

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

View File

@ -40,7 +40,7 @@ public:
///
/// @brief Destructor
///
~FlatBufferConnection();
~FlatBufferConnection() override;
/// @brief Do not read reply messages from Hyperion if set to true
void setSkipReply(bool skip);

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:
///

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,7 +30,7 @@ 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(settings::type type, const QJsonDocument& config) override;

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

@ -38,25 +38,25 @@ public:
/// @brief Get the unique id (imported from removed class 'Stats')
/// @return The unique id
///
const QString &getID() const { return _uuid; };
QString getID() const { return _uuid; }
///
/// @brief Check authorization is required according to the user setting
/// @return True if authorization required else false
///
bool isAuthRequired() const { return _authRequired; };
bool isAuthRequired() const { return _authRequired; }
///
/// @brief Check if authorization is required for local network connections
/// @return True if authorization required else false
///
bool isLocalAuthRequired() const { 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
///
bool isLocalAdminAuthRequired() const { 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:
@ -164,19 +164,19 @@ public slots:
/// @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

View File

@ -13,7 +13,7 @@ public:
/// Unique identifier for this color transform
QString _id;
/// The BLACK (RGB-Channel) adjustment
RgbChannelAdjustment _rgbBlackAdjustment;
/// The WHITE (RGB-Channel) adjustment

View File

@ -20,7 +20,7 @@ class ComponentRegister : public QObject
public:
ComponentRegister(Hyperion* hyperion);
~ComponentRegister();
~ComponentRegister() override;
///
/// @brief Check if a component is currently enabled
@ -30,7 +30,7 @@ public:
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:
///

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, 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();

View File

@ -168,7 +168,7 @@ public slots:
/// 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
@ -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
@ -266,7 +266,7 @@ public slots:
/// gets current state of automatic/priorized source selection
/// @return the state
bool sourceAutoSelectEnabled();
bool sourceAutoSelectEnabled() const;
///
/// Returns the current priority
@ -309,7 +309,7 @@ public slots:
/// 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, bool correct = false);
bool saveSettings(const QJsonObject& config, bool correct = false);
/// ############
/// COMPONENTREGISTER
@ -345,7 +345,7 @@ public slots:
/// @param The component to test
/// @return Component state
///
int isComponentEnabled(hyperion::Components comp);
int isComponentEnabled(hyperion::Components comp) const;
/// sets the methode how image is maped to leds at ImageProcessor
void setLedMappingType(int mappingType);
@ -402,10 +402,10 @@ 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

View File

@ -38,7 +38,7 @@ public slots:
/// @param inst The instance to check
/// @return True when running else false
///
bool IsInstanceRunning(quint8 inst) { return _runningInstances.contains(inst); }
bool IsInstanceRunning(quint8 inst) const { return _runningInstances.contains(inst); }
///
/// @brief Get a Hyperion instance by index
@ -50,7 +50,7 @@ public slots:
///
/// @brief Get instance data of all instaces in db + running state
///
const QVector<QVariantMap> getInstanceData();
QVector<QVariantMap> getInstanceData() const;
///
/// @brief Start a Hyperion instance
@ -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(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
@ -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!
int getUserLedMappingType() { return _userMappingType; };
int getUserLedMappingType() const { return _userMappingType; }
/// Returns the current _mappingType
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);
///

View File

@ -57,8 +57,8 @@ namespace hyperion
///
unsigned height() const;
unsigned horizontalBorder() { return _horizontalBorder; };
unsigned verticalBorder() { 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:
///

View File

@ -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,7 +68,7 @@ public:
///
/// Destructor
///
~PriorityMuxer();
~PriorityMuxer() override;
///
/// @brief Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend
@ -185,7 +185,7 @@ public:
///
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes)
///
void queuePush(){ emit timeRunner(); };
void queuePush() { emit timeRunner(); }
signals:
///
@ -253,7 +253,7 @@ private:
/// @brief Get the component of the given priority
/// @return The component
///
hyperion::Components getComponentOfPriority(int priority);
hyperion::Components getComponentOfPriority(int priority) const;
/// Logger instance
Logger* _log;

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

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

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", 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.
@ -115,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, quint16 flatBufPort, quint16 jsonServerPort, const QString &name, QObject * parent = nullptr);
~SSDPHandler();
~SSDPHandler() override;
///
/// @brief Sends BYE BYE and stop server

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
@ -81,7 +82,7 @@ public:
///
/// @brief Get current flatbuffer server port
///
quint16 getFlatBufPort() { return _fbsPort.toInt(); };
quint16 getFlatBufPort() const { return _fbsPort.toInt(); };
///
/// @brief set new jsonserver server port
@ -91,7 +92,7 @@ public:
///
/// @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:

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

@ -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

@ -25,13 +25,13 @@ public:
/// @param local The local address of the socket (Differs based on NetworkAdapter IP or localhost)
/// @return True when allowed, else false
///
bool accessAllowed(const QHostAddress& address, const QHostAddress& local);
bool accessAllowed(const QHostAddress& address, const QHostAddress& local) const;
///
/// @brief Check if address is in subnet of local
/// @return True or false
///
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local);
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local) const;
static NetOrigin* getInstance(){ return instance; };
static NetOrigin* instance;

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

@ -6,6 +6,6 @@
namespace Process {
void restartHyperion(bool asNewProcess=false);
QByteArray command_exec(QString cmd, QByteArray data="");
QByteArray command_exec(const QString& cmd, const QByteArray& data="");
}

View File

@ -36,8 +36,8 @@ 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);
WhiteAlgorithm stringToWhiteAlgorithm(const QString& str);
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm);
}

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

@ -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,7 +28,8 @@ 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:

View File

@ -494,7 +494,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
#if defined(ENABLE_V4L2)
QJsonArray availableV4L2devices;
for (auto devicePath : GrabberWrapper::getInstance()->getV4L2devices())
for (const auto& devicePath : GrabberWrapper::getInstance()->getV4L2devices())
{
QJsonObject device;
device["device"] = devicePath;

View File

@ -89,8 +89,8 @@ void BlackBorderProcessor::handleCompStateChangeRequest(hyperion::Components com
}
}
void BlackBorderProcessor::setHardDisable(bool disable) {
void BlackBorderProcessor::setHardDisable(bool disable)
{
if (disable)
{
_enabled = false;

View File

@ -67,7 +67,7 @@ void BoblightServer::stop()
_hyperion->setNewComponentState(COMP_BOBLIGHTSERVER, _server->isListening());
}
bool BoblightServer::active()
bool BoblightServer::active() const
{
return _server->isListening();
}

View File

@ -65,7 +65,7 @@ void BonjourServiceRegister::registerService(const QString& service, int port)
);
}
void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort, std::vector<std::pair<std::string, std::string>> txt)
void BonjourServiceRegister::registerService(const BonjourRecord &record, quint16 servicePort, const std::vector<std::pair<std::string, std::string>>& txt)
{
if (dnssref)
{

View File

@ -11,7 +11,6 @@ Option::Option(const QStringList &names, const QString &description, const QStri
: QCommandLineOption(names, description, valueName, defaultValue)
{}
bool Option::validate(Parser & parser, QString &value)
{
/* By default everything is accepted */
@ -22,22 +21,22 @@ Option::Option(const QCommandLineOption &other)
: QCommandLineOption(other)
{}
QString Option::value(Parser &parser)
QString Option::value(Parser &parser) const
{
return parser.value(*this);
}
QString Option::name()
QString Option::name() const
{
return this->names().last();
}
QString Option::getError()
QString Option::getError() const
{
return this->_error;
}
const char* Option::getCString(Parser &parser)
const char* Option::getCString(Parser &parser) const
{
return value(parser).toLocal8Bit().constData();
}

View File

@ -61,9 +61,9 @@ QString EffectEngine::deleteEffect(const QString& effectName)
return _effectFileHandler->deleteEffect(effectName);
}
const std::list<ActiveEffectDefinition> &EffectEngine::getActiveEffects()
std::list<ActiveEffectDefinition> EffectEngine::getActiveEffects() const
{
_availableActiveEffects.clear();
std::list<ActiveEffectDefinition> availableActiveEffects;
for (Effect * effect : _activeEffects)
{
@ -73,13 +73,13 @@ const std::list<ActiveEffectDefinition> &EffectEngine::getActiveEffects()
activeEffectDefinition.priority = effect->getPriority();
activeEffectDefinition.timeout = effect->getTimeout();
activeEffectDefinition.args = effect->getArgs();
_availableActiveEffects.push_back(activeEffectDefinition);
availableActiveEffects.push_back(activeEffectDefinition);
}
return _availableActiveEffects;
return availableActiveEffects;
}
const std::list<EffectSchema> & EffectEngine::getEffectSchemas()
std::list<EffectSchema> EffectEngine::getEffectSchemas() const
{
return _effectFileHandler->getEffectSchemas();
}

View File

@ -65,8 +65,6 @@ public:
return physicalAddress;
}
IonBuffer(size_t bufferSize)
: bufferSize(bufferSize)
{

View File

@ -30,7 +30,7 @@ int vc_dispmanx_display_get_info(int, DISPMANX_MODEINFO_T *vc_info)
return 0;
}
DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int,int width,int height, uint32_t *)
DISPMANX_RESOURCE_HANDLE_T vc_dispmanx_resource_create(int, int width, int height, uint32_t *)
{
return new DISPMANX_RESOURCE(width,height);
}
@ -61,12 +61,12 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags)
{
__bcm_frame_counter = 0;
}
ColorRgba color[4] = {ColorRgba::RED, ColorRgba::BLUE, ColorRgba::GREEN, ColorRgba::WHITE};
if (__bcm_frame_counter < 25)
{
color[0] = ColorRgba::WHITE;
color[1] = ColorRgba::RED;
0 color[1] = ColorRgba::RED;
color[2] = ColorRgba::BLUE;
color[3] = ColorRgba::GREEN;
}
@ -95,7 +95,7 @@ int vc_dispmanx_snapshot(int, DISPMANX_RESOURCE_HANDLE_T resource, int vc_flags)
if (x < w/2 && y < h/2) id = 1;
if (x < w/2 && y >= h/2) id = 2;
if (x >= w/2 && y < h/2) id = 3;
resource->memptr()[y*w + x] = color[id];
}
}

View File

@ -30,7 +30,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image)
{
__osx_frame_counter = 0;
}
ColorRgb color[4] = {ColorRgb::RED, ColorRgb::BLUE, ColorRgb::GREEN, ColorRgb::WHITE};
if (__osx_frame_counter < 25)
{
@ -55,7 +55,7 @@ CGImageRef CGImageGetDataProvider(CGImageRef image)
}
unsigned w = image->width();
unsigned h = image->height();
for (unsigned y=0; y<h; y++)
{
for (unsigned x=0; x<w; x++)
@ -64,11 +64,11 @@ CGImageRef CGImageGetDataProvider(CGImageRef image)
if (x < w/2 && y < h/2) id = 1;
if (x < w/2 && y >= h/2) id = 2;
if (x >= w/2 && y < h/2) id = 3;
image->memptr()[y*w + x] = color[id];
}
}
return image;
}

View File

@ -31,10 +31,10 @@
#endif
V4L2Grabber::V4L2Grabber(const QString & device
, const unsigned width
, const unsigned height
, const unsigned fps
, const unsigned input
, unsigned width
, unsigned height
, unsigned fps
, unsigned input
, VideoStandard videoStandard
, PixelFormat pixelFormat
, int pixelDecimation
@ -1368,7 +1368,7 @@ bool V4L2Grabber::setFramerate(int fps)
return false;
}
QStringList V4L2Grabber::getV4L2devices()
QStringList V4L2Grabber::getV4L2devices() const
{
QStringList result = QStringList();
for (auto it = _deviceProperties.begin(); it != _deviceProperties.end(); ++it)
@ -1378,22 +1378,22 @@ QStringList V4L2Grabber::getV4L2devices()
return result;
}
QString V4L2Grabber::getV4L2deviceName(QString devicePath)
QString V4L2Grabber::getV4L2deviceName(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).name;
}
QMultiMap<QString, int> V4L2Grabber::getV4L2deviceInputs(QString devicePath)
QMultiMap<QString, int> V4L2Grabber::getV4L2deviceInputs(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).inputs;
}
QStringList V4L2Grabber::getResolutions(QString devicePath)
QStringList V4L2Grabber::getResolutions(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).resolutions;
}
QStringList V4L2Grabber::getFramerates(QString devicePath)
QStringList V4L2Grabber::getFramerates(const QString& devicePath) const
{
return _deviceProperties.value(devicePath).framerates;
}

View File

@ -6,10 +6,10 @@
#include <QTimer>
V4L2Wrapper::V4L2Wrapper(const QString &device,
const unsigned grabWidth,
const unsigned grabHeight,
const unsigned fps,
const unsigned input,
unsigned grabWidth,
unsigned grabHeight,
unsigned fps,
unsigned input,
VideoStandard videoStandard,
PixelFormat pixelFormat,
int pixelDecimation )
@ -85,7 +85,7 @@ void V4L2Wrapper::setSignalDetectionEnable(bool enable)
_grabber.setSignalDetectionEnable(enable);
}
bool V4L2Wrapper::getSignalDetectionEnable()
bool V4L2Wrapper::getSignalDetectionEnable() const
{
return _grabber.getSignalDetectionEnabled();
}
@ -95,12 +95,12 @@ void V4L2Wrapper::setCecDetectionEnable(bool enable)
_grabber.setCecDetectionEnable(enable);
}
bool V4L2Wrapper::getCecDetectionEnable()
bool V4L2Wrapper::getCecDetectionEnable() const
{
return _grabber.getCecDetectionEnabled();
}
void V4L2Wrapper::setDeviceVideoStandard(QString device, VideoStandard videoStandard)
void V4L2Wrapper::setDeviceVideoStandard(const QString& device, VideoStandard videoStandard)
{
_grabber.setDeviceVideoStandard(device, videoStandard);
}

View File

@ -61,7 +61,7 @@ AuthManager::AuthDefinition AuthManager::createToken(const QString &comment)
return def;
}
QVector<AuthManager::AuthDefinition> AuthManager::getTokenList()
QVector<AuthManager::AuthDefinition> AuthManager::getTokenList() const
{
QVector<QVariantMap> vector = _authTable->getTokenList();
QVector<AuthManager::AuthDefinition> finalVec;
@ -79,7 +79,7 @@ QVector<AuthManager::AuthDefinition> AuthManager::getTokenList()
return finalVec;
}
const QString AuthManager::getUserToken(const QString &usr)
QString AuthManager::getUserToken(const QString &usr) const
{
QString tok = _authTable->getUserToken(usr);
return QString(_authTable->getUserToken(usr));
@ -192,7 +192,7 @@ void AuthManager::handlePendingTokenRequest(const QString &id, bool accept)
}
}
QVector<AuthManager::AuthDefinition> AuthManager::getPendingRequests()
QVector<AuthManager::AuthDefinition> AuthManager::getPendingRequests() const
{
QVector<AuthManager::AuthDefinition> finalVec;
for (const auto &entry : _pendingRequests)

View File

@ -1,7 +1,6 @@
#include <hyperion/Grabber.h>
Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
Grabber::Grabber(const QString& grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
: _imageResampler()
, _useImageResampler(true)
, _videoMode(VideoMode::VIDEO_2D)

View File

@ -11,7 +11,7 @@
GrabberWrapper* GrabberWrapper::instance = nullptr;
GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz)
GrabberWrapper::GrabberWrapper(const QString& grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz)
: _grabberName(grabberName)
, _timer(new QTimer(this))
, _updateInterval_ms(1000/updateRate_Hz)
@ -201,7 +201,7 @@ void GrabberWrapper::tryStart()
}
}
QStringList GrabberWrapper::getV4L2devices()
QStringList GrabberWrapper::getV4L2devices() const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2devices();
@ -209,7 +209,7 @@ QStringList GrabberWrapper::getV4L2devices()
return QStringList();
}
QString GrabberWrapper::getV4L2deviceName(QString devicePath)
QString GrabberWrapper::getV4L2deviceName(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2deviceName(devicePath);
@ -217,7 +217,7 @@ QString GrabberWrapper::getV4L2deviceName(QString devicePath)
return QString();
}
QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(QString devicePath)
QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getV4L2deviceInputs(devicePath);
@ -225,7 +225,7 @@ QMultiMap<QString, int> GrabberWrapper::getV4L2deviceInputs(QString devicePath)
return QMultiMap<QString, int>();
}
QStringList GrabberWrapper::getResolutions(QString devicePath)
QStringList GrabberWrapper::getResolutions(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getResolutions(devicePath);
@ -233,7 +233,7 @@ QStringList GrabberWrapper::getResolutions(QString devicePath)
return QStringList();
}
QStringList GrabberWrapper::getFramerates(QString devicePath)
QStringList GrabberWrapper::getFramerates(const QString& devicePath) const
{
if(_grabberName.startsWith("V4L"))
return _ggrabber->getFramerates(devicePath);

View File

@ -255,7 +255,7 @@ QJsonDocument Hyperion::getSetting(settings::type type) const
return _settingsManager->getSetting(type);
}
bool Hyperion::saveSettings(QJsonObject config, bool correct)
bool Hyperion::saveSettings(const QJsonObject& config, bool correct)
{
return _settingsManager->saveSettings(config, correct);
}
@ -290,7 +290,7 @@ bool Hyperion::setVisiblePriority(int priority)
return _muxer.setPriority(priority);
}
bool Hyperion::sourceAutoSelectEnabled()
bool Hyperion::sourceAutoSelectEnabled() const
{
return _muxer.isSourceAutoSelectEnabled();
}
@ -305,7 +305,7 @@ std::map<hyperion::Components, bool> Hyperion::getAllComponents() const
return _componentRegister.getRegister();
}
int Hyperion::isComponentEnabled(hyperion::Components comp)
int Hyperion::isComponentEnabled(hyperion::Components comp) const
{
return _componentRegister.isComponentEnabled(comp);
}
@ -396,7 +396,7 @@ end:
_muxer.queuePush();
}
const QStringList & Hyperion::getAdjustmentIds() const
QStringList Hyperion::getAdjustmentIds() const
{
return _raw2ledAdjustment->getAdjustmentIds();
}
@ -464,22 +464,22 @@ QString Hyperion::deleteEffect(const QString& effectName)
return _effectEngine->deleteEffect(effectName);
}
const std::list<EffectDefinition> & Hyperion::getEffects() const
std::list<EffectDefinition> Hyperion::getEffects() const
{
return _effectEngine->getEffects();
}
const std::list<ActiveEffectDefinition> & Hyperion::getActiveEffects() const
std::list<ActiveEffectDefinition> Hyperion::getActiveEffects() const
{
return _effectEngine->getActiveEffects();
}
const std::list<EffectSchema> & Hyperion::getEffectSchemas() const
std::list<EffectSchema> Hyperion::getEffectSchemas() const
{
return _effectEngine->getEffectSchemas();
}
const QJsonObject& Hyperion::getQJsonConfig() const
QJsonObject Hyperion::getQJsonConfig() const
{
return _settingsManager->getSettings();
}

View File

@ -28,7 +28,7 @@ Hyperion* HyperionIManager::getHyperionInstance(quint8 instance)
return _runningInstances.value(0);
}
const QVector<QVariantMap> HyperionIManager::getInstanceData()
QVector<QVariantMap> HyperionIManager::getInstanceData() const
{
QVector<QVariantMap> instances = _instanceTable->getAllInstances();
for( auto & entry : instances)

View File

@ -10,7 +10,7 @@
using namespace hyperion;
// global transform method
int ImageProcessor::mappingTypeToInt(QString mappingType)
int ImageProcessor::mappingTypeToInt(const QString& mappingType)
{
if (mappingType == "unicolor_mean" )
return 1;
@ -99,7 +99,7 @@ void ImageProcessor::setBlackbarDetectDisable(bool enable)
_borderProcessor->setHardDisable(enable);
}
bool ImageProcessor::blackBorderDetectorEnabled()
bool ImageProcessor::blackBorderDetectorEnabled() const
{
return _borderProcessor->enabled();
}

View File

@ -156,7 +156,7 @@ void MessageForwarder::handlePriorityChanges(quint8 priority)
}
}
void MessageForwarder::addJsonSlave(QString slave)
void MessageForwarder::addJsonSlave(const QString& slave)
{
QStringList parts = slave.split(":");
if (parts.size() != 2)
@ -185,7 +185,7 @@ void MessageForwarder::addJsonSlave(QString slave)
_jsonSlaves << slave;
}
void MessageForwarder::addFlatbufferSlave(QString slave)
void MessageForwarder::addFlatbufferSlave(const QString& slave)
{
QStringList parts = slave.split(":");
if (parts.size() != 2)

View File

@ -67,7 +67,7 @@ bool MultiColorAdjustment::verifyAdjustments() const
return ok;
}
const QStringList & MultiColorAdjustment::getAdjustmentIds()
QStringList MultiColorAdjustment::getAdjustmentIds() const
{
return _adjustmentIds;
}

View File

@ -133,7 +133,7 @@ PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(int priority) const
return elemIt.value();
}
hyperion::Components PriorityMuxer::getComponentOfPriority(int priority)
hyperion::Components PriorityMuxer::getComponentOfPriority(int priority) const
{
return _activeInputs[priority].componentId;
}

View File

@ -130,7 +130,7 @@ bool SettingsManager::saveSettings(QJsonObject config, bool correct)
Warning(_log,"Fixing json data!");
config = schemaChecker.getAutoCorrectedConfig(config);
for (auto & schemaError : schemaChecker.getMessages())
for (const auto & schemaError : schemaChecker.getMessages())
Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError));
}

View File

@ -35,21 +35,21 @@ protected:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device.
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -57,7 +57,7 @@ protected:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
private:

View File

@ -67,7 +67,7 @@ void LedDeviceWrapper::createLedDevice(const QJsonObject& config)
thread->start();
}
const QJsonObject LedDeviceWrapper::getLedDeviceSchemas()
QJsonObject LedDeviceWrapper::getLedDeviceSchemas()
{
// make sure the resources are loaded (they may be left out after static linking)
Q_INIT_RESOURCE(LedDeviceSchemas);
@ -118,21 +118,21 @@ const LedDeviceRegistry& LedDeviceWrapper::getDeviceMap()
return _ledDeviceMap;
}
int LedDeviceWrapper::getLatchTime()
int LedDeviceWrapper::getLatchTime() const
{
int value = 0;
QMetaObject::invokeMethod(_ledDevice, "getLatchTime", Qt::BlockingQueuedConnection, Q_RETURN_ARG(int, value));
return value;
}
QString LedDeviceWrapper::getActiveDeviceType()
QString LedDeviceWrapper::getActiveDeviceType() const
{
QString value = 0;
QMetaObject::invokeMethod(_ledDevice, "getActiveDeviceType", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value));
return value;
}
QString LedDeviceWrapper::getColorOrder()
QString LedDeviceWrapper::getColorOrder() const
{
QString value;
QMetaObject::invokeMethod(_ledDevice, "getColorOrder", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value));
@ -146,7 +146,7 @@ unsigned int LedDeviceWrapper::getLedCount() const
return value;
}
bool LedDeviceWrapper::enabled()
bool LedDeviceWrapper::enabled() const
{
return _enabled;
}

View File

@ -43,14 +43,14 @@ public:
///
/// Destructor of the LedDevice; closes the output device if it is open
///
virtual ~LedDeviceHyperionUsbasp() override;
~LedDeviceHyperionUsbasp() override;
public slots:
///
/// Closes the output device.
/// Includes switching-off the device and stopping refreshes
///
virtual int close() override;
int close() override;
protected:
///
@ -67,7 +67,7 @@ protected:
///
/// @return Zero on success else negative
///
virtual int write(const std::vector<ColorRgb>& ledValues) override;
int write(const std::vector<ColorRgb>& ledValues) override;
///
/// Test if the device is a Hyperion Usbasp device

View File

@ -34,7 +34,7 @@ public:
///
/// @brief Destructor of the LedDevice
///
virtual ~LedDeviceLightpack() override;
~LedDeviceLightpack() override;
///
/// @brief Constructs the LED-device
@ -50,28 +50,28 @@ public:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device.
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Power-/turn off the Nanoleaf device.
///
/// @return True if success
///
virtual bool powerOff() override;
bool powerOff() override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -100,7 +100,7 @@ protected:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
private:

View File

@ -31,7 +31,7 @@ public:
///
/// @brief Destructor of the LedDevice
///
virtual ~LedDeviceMultiLightpack() override;
~LedDeviceMultiLightpack() override;
///
/// @brief Constructs the LED-device
@ -49,28 +49,28 @@ protected:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device.
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Power-/turn off the Nanoleaf device.
///
/// @return True if success
///
virtual bool powerOff() override;
bool powerOff() override;
///
/// @brief Writes the RGB-Color values to the LEDs.

View File

@ -34,7 +34,7 @@ private:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -42,7 +42,7 @@ private:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
};
#endif // LEDEVICEPAINTTPACK_H

View File

@ -37,7 +37,7 @@ private:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -45,7 +45,7 @@ private:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
};
#endif // LEDEVICERAWHID_H

View File

@ -156,28 +156,30 @@ int ProviderHID::writeBytes(unsigned size, const uint8_t * data)
else{
ret = hid_write(_deviceHandle, ledData, size + 1);
}
// Handle first error
if(ret < 0){
if(ret < 0)
{
Error(_log,"Failed to write to HID device.");
// Try again
if(_useFeature){
if(_useFeature)
{
ret = hid_send_feature_report(_deviceHandle, ledData, size + 1);
}
else{
else
{
ret = hid_write(_deviceHandle, ledData, size + 1);
}
// Writing failed again, device might have disconnected
if(ret < 0){
Error(_log,"Failed to write to HID device.");
hid_close(_deviceHandle);
_deviceHandle = nullptr;
}
}
return ret;
}

View File

@ -26,14 +26,14 @@ public:
///
/// @brief Destructor of the LedDevice
///
virtual ~ProviderHID() override;
~ProviderHID() override;
///
/// @brief Discover HIB (USB) devices available (for configuration).
///
/// @return A JSON structure holding a list of devices found
///
virtual QJsonObject discover() override;
QJsonObject discover() override;
protected:
@ -43,21 +43,21 @@ protected:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device.
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Write the given bytes to the HID-device

View File

@ -33,7 +33,7 @@ public:
///
/// @brief Destructor of the LedDevice
///
virtual ~LedDeviceAtmoOrb() override;
~LedDeviceAtmoOrb() override;
///
/// @brief Constructs the LED-device
@ -51,21 +51,21 @@ protected:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device.
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -73,7 +73,7 @@ protected:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
private:

View File

@ -151,7 +151,7 @@ int LedDeviceFadeCandy::close()
return retval;
}
bool LedDeviceFadeCandy::isConnected()
bool LedDeviceFadeCandy::isConnected() const
{
bool connected = false;
if ( _client != nullptr )
@ -204,7 +204,7 @@ int LedDeviceFadeCandy::transferData()
return -2;
}
int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg)
int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, const QByteArray& msg)
{
if ( isConnected() )
{

View File

@ -62,21 +62,21 @@ protected:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device.
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -84,7 +84,7 @@ protected:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
private:
@ -106,7 +106,7 @@ private:
///
/// @return True, if connection established
///
bool isConnected();
bool isConnected() const;
///
/// @brief Transfer current opc_data buffer to opc server
@ -114,7 +114,7 @@ private:
/// @return amount of transferred bytes. -1 error while transferring, -2 error while connecting
///
int transferData();
///
/// @brief Send system exclusive commands
///
@ -122,7 +122,7 @@ private:
/// @param[in] commandId id of command
/// @param[in] msg the sysEx message
/// @return amount bytes written, -1 if failed
int sendSysEx(uint8_t systemId, uint8_t commandId, QByteArray msg);
int sendSysEx(uint8_t systemId, uint8_t commandId, const QByteArray& msg);
///
/// @brief Sends the configuration to fadecandy cserver

View File

@ -513,7 +513,7 @@ bool LedDeviceNanoleaf::powerOff()
return true;
}
QString LedDeviceNanoleaf::getOnOffRequest (bool isOn ) const
QString LedDeviceNanoleaf::getOnOffRequest(bool isOn) const
{
QString state = isOn ? STATE_VALUE_TRUE : STATE_VALUE_FALSE;
return QString( "{\"%1\":{\"%2\":%3}}" ).arg(STATE_ON, STATE_ONOFF_VALUE, state);
@ -614,7 +614,7 @@ int LedDeviceNanoleaf::write(const std::vector<ColorRgb> & ledValues)
return retVal;
}
std::string LedDeviceNanoleaf:: uint8_vector_to_hex_string( const std::vector<uint8_t>& buffer ) const
std::string LedDeviceNanoleaf::uint8_vector_to_hex_string(const std::vector<uint8_t>& buffer) const
{
std::stringstream ss;
ss << std::hex << std::setfill('0');

View File

@ -37,7 +37,7 @@ public:
///
/// @brief Destructor of the LED-device
///
virtual ~LedDeviceNanoleaf() override;
~LedDeviceNanoleaf() override;
///
/// @brief Constructs the LED-device
@ -51,7 +51,7 @@ public:
///
/// @return A JSON structure holding a list of devices found
///
virtual QJsonObject discover() override;
QJsonObject discover() override;
///
/// @brief Get the Nanoleaf device's resource properties
@ -68,7 +68,7 @@ public:
/// @param[in] params Parameters to query device
/// @return A JSON structure holding the device's properties
///
virtual QJsonObject getProperties(const QJsonObject& params) override;
QJsonObject getProperties(const QJsonObject& params) override;
///
/// @brief Send an update to the Nanoleaf device to identify it.
@ -83,7 +83,7 @@ public:
///
/// @param[in] params Parameters to address device
///
virtual void identify(const QJsonObject& params) override;
void identify(const QJsonObject& params) override;
protected:
@ -100,7 +100,7 @@ protected:
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -108,21 +108,21 @@ protected:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
//////
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
///
/// @brief Power-/turn on the Nanoleaf device.
///
/// @brief Store the device's original state.
///
virtual bool powerOn() override;
bool powerOn() override;
///
/// @brief Power-/turn off the Nanoleaf device.
///
/// @return True if success
///
virtual bool powerOff() override;
bool powerOff() override;
private:

View File

@ -347,7 +347,7 @@ bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
return isInitOK;
}
bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token )
bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token)
{
bool isInitOK = false;
@ -403,12 +403,12 @@ int LedDevicePhilipsHueBridge::close()
return retval;
}
const int *LedDevicePhilipsHueBridge::getCiphersuites()
const int *LedDevicePhilipsHueBridge::getCiphersuites() const
{
return SSL_CIPHERSUITES;
}
void LedDevicePhilipsHueBridge::log(const char* msg, const char* type, ...)
void LedDevicePhilipsHueBridge::log(const char* msg, const char* type, ...) const
{
const size_t max_val_length = 1024;
char val[max_val_length];
@ -544,17 +544,17 @@ void LedDevicePhilipsHueBridge::setGroupMap(const QJsonDocument &doc)
}
}
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getLightMap()
QMap<quint16,QJsonObject> LedDevicePhilipsHueBridge::getLightMap() const
{
return _lightsMap;
}
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getGroupMap()
QMap<quint16,QJsonObject> LedDevicePhilipsHueBridge::getGroupMap() const
{
return _groupsMap;
}
QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId)
QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId) const
{
QString groupName;
if( _groupsMap.contains( groupId ) )
@ -569,7 +569,7 @@ QString LedDevicePhilipsHueBridge::getGroupName(quint16 groupId)
return groupName;
}
QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId)
QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId) const
{
QJsonArray groupLights;
// search user groupid inside _groupsMap and create light if found
@ -599,13 +599,13 @@ QJsonArray LedDevicePhilipsHueBridge::getGroupLights(quint16 groupId)
return groupLights;
}
bool LedDevicePhilipsHueBridge::checkApiError(const QJsonDocument &response )
bool LedDevicePhilipsHueBridge::checkApiError(const QJsonDocument &response)
{
bool apiError = false;
QString errorReason;
QString strJson(response.toJson(QJsonDocument::Compact));
DebugIf(verbose, _log, "Reply: [%s]", strJson.toUtf8().constData() );
DebugIf(verbose, _log, "Reply: [%s]", strJson.toUtf8().constData());
QVariantList rspList = response.toVariant().toList();
if ( !rspList.isEmpty() )
@ -662,7 +662,7 @@ QJsonDocument LedDevicePhilipsHueBridge::setGroupState(unsigned int groupId, boo
return post( QString("%1/%2").arg( API_GROUPS ).arg( groupId ), QString("{\"%1\":{\"%2\":%3}}").arg( API_STREAM, API_STREAM_ACTIVE, active ) );
}
bool LedDevicePhilipsHueBridge::isStreamOwner(const QString &streamOwner)
bool LedDevicePhilipsHueBridge::isStreamOwner(const QString &streamOwner) const
{
return ( streamOwner != "" && streamOwner == _username );
}
@ -1254,13 +1254,13 @@ bool LedDevicePhilipsHue::setStreamGroupState(bool state)
return false;
}
QByteArray LedDevicePhilipsHue::prepareStreamData()
QByteArray LedDevicePhilipsHue::prepareStreamData() const
{
QByteArray msg;
msg.reserve(static_cast<int>(sizeof(HEADER) + sizeof(PAYLOAD_PER_LIGHT) * _lights.size()));
msg.append((const char*)HEADER, sizeof(HEADER));
for (PhilipsHueLight& light : _lights)
for (const PhilipsHueLight& light : _lights)
{
CiColor lightC = light.getColor();
quint64 R = lightC.x * 0xffff;

View File

@ -208,13 +208,13 @@ public:
void setLightState(unsigned int lightId = 0, const QString &state = "");
const QMap<quint16,QJsonObject>& getLightMap();
QMap<quint16,QJsonObject> getLightMap() const;
const QMap<quint16,QJsonObject>& getGroupMap();
QMap<quint16,QJsonObject> getGroupMap() const;
QString getGroupName(quint16 groupId = 0);
QString getGroupName(quint16 groupId = 0) const;
QJsonArray getGroupLights(quint16 groupId = 0);
QJsonArray getGroupLights(quint16 groupId = 0) const;
@ -226,21 +226,21 @@ protected:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the Hue-Bridge device and its SSL-connection
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the Hue-Bridge device and its SSL-connection
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Check, if Hue API response indicate error
@ -264,12 +264,12 @@ protected:
QJsonDocument getGroupState( unsigned int groupId );
QJsonDocument setGroupState( unsigned int groupId, bool state);
bool isStreamOwner(const QString &streamOwner);
bool isStreamOwner(const QString &streamOwner) const;
bool initMaps();
void log(const char* msg, const char* type, ...);
void log(const char* msg, const char* type, ...) const;
const int * getCiphersuites() override;
const int * getCiphersuites() const override;
private:
@ -316,7 +316,7 @@ public:
///
/// @brief Destructor of the LED-device
///
virtual ~LedDevicePhilipsHue();
~LedDevicePhilipsHue();
///
/// @brief Constructs the LED-device
@ -331,7 +331,7 @@ public:
///
/// @return A JSON structure holding a list of devices found
///
virtual QJsonObject discover() override;
QJsonObject discover() override;
///
/// @brief Get the Hue Bridge device's resource properties
@ -348,7 +348,7 @@ public:
/// @param[in] params Parameters to query device
/// @return A JSON structure holding the device's properties
///
virtual QJsonObject getProperties(const QJsonObject& params) override;
QJsonObject getProperties(const QJsonObject& params) override;
///
/// @brief Send an update to the device to identify it.
@ -357,7 +357,7 @@ public:
///
/// @param[in] params Parameters to address device
///
virtual void identify(const QJsonObject& params) override;
void identify(const QJsonObject& params) override;
///
/// @brief Get the number of LEDs supported by the device.
@ -378,7 +378,7 @@ public slots:
///
/// Includes switching-off the device and stopping refreshes.
///
virtual void stop() override;
void stop() override;
protected:
@ -388,21 +388,21 @@ protected:
/// @param deviceConfig Device's configuration in JSON
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Opens the output device
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open() override;
int open() override;
///
/// @brief Closes the output device.
///
/// @return Zero on success (i.e. device is closed), else negative
///
virtual int close() override;
int close() override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -410,7 +410,7 @@ protected:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb>& ledValues) override;
int write(const std::vector<ColorRgb>& ledValues) override;
///
/// @brief Switch the LEDs on.
@ -421,7 +421,7 @@ protected:
///
/// @return True if success
///
//virtual bool switchOn() override;
//bool switchOn() override;
///
/// @brief Switch the LEDs off.
@ -432,7 +432,7 @@ protected:
///
/// @return True, if success
///
virtual bool switchOff() override;
bool switchOff() override;
///
/// @brief Power-/turn on the LED-device.
@ -441,7 +441,7 @@ protected:
///
/// @return True, if success
///
virtual bool powerOn() override;
bool powerOn() override;
///
/// @brief Power-/turn off the LED-device.
@ -451,7 +451,7 @@ protected:
///
/// @return True, if success
///
virtual bool powerOff() override;
bool powerOff() override;
///
/// @brief Store the device's original state.
@ -460,7 +460,7 @@ protected:
///
/// @return True if success
///
virtual bool storeState() override;
bool storeState() override;
///
/// @brief Restore the device's original state.
@ -470,7 +470,7 @@ protected:
///
/// @return True, if success
///
virtual bool restoreState() override;
bool restoreState() override;
private slots:
@ -515,7 +515,7 @@ private:
void stopBlackTimeoutTimer();
QByteArray prepareStreamData();
QByteArray prepareStreamData() const;
///
bool _switchOffOnBlack;

View File

@ -34,7 +34,7 @@ private:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -42,7 +42,7 @@ private:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
int _tpm2_max;
int _tpm2ByteCount;

View File

@ -67,7 +67,7 @@ private:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -75,7 +75,7 @@ private:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
///
/// @brief Generate Art-Net communication header

View File

@ -112,7 +112,7 @@ private:
/// @param[in] deviceConfig the JSON device configuration
/// @return True, if success
///
virtual bool init(const QJsonObject &deviceConfig) override;
bool init(const QJsonObject &deviceConfig) override;
///
/// @brief Writes the RGB-Color values to the LEDs.
@ -120,7 +120,7 @@ private:
/// @param[in] ledValues The RGB-color per LED
/// @return Zero on success, else negative
///
virtual int write(const std::vector<ColorRgb> & ledValues) override;
int write(const std::vector<ColorRgb> & ledValues) override;
///
/// @brief Generate E1.31 communication header

Some files were not shown because too many files have changed in this diff Show More