mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge branch 'master' into refactor/led_device
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
API::API(Logger *log, const bool &localConnection, QObject *parent)
|
||||
API::API(Logger *log, bool localConnection, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
qRegisterMetaType<int64_t>("int64_t");
|
||||
@@ -59,7 +59,7 @@ API::API(Logger *log, const bool &localConnection, QObject *parent)
|
||||
connect(_authManager, &AuthManager::tokenResponse, this, &API::checkTokenResponse);
|
||||
}
|
||||
|
||||
void API::init(void)
|
||||
void API::init()
|
||||
{
|
||||
bool apiAuthRequired = _authManager->isAuthRequired();
|
||||
|
||||
@@ -82,7 +82,7 @@ void API::init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void API::setColor(const int &priority, const std::vector<uint8_t> &ledColors, const int &timeout_ms, const QString &origin, const hyperion::Components &callerComp)
|
||||
void API::setColor(int priority, const std::vector<uint8_t> &ledColors, int timeout_ms, const QString &origin, hyperion::Components callerComp)
|
||||
{
|
||||
std::vector<ColorRgb> fledColors;
|
||||
if (ledColors.size() % 3 == 0)
|
||||
@@ -95,7 +95,7 @@ void API::setColor(const int &priority, const std::vector<uint8_t> &ledColors, c
|
||||
}
|
||||
}
|
||||
|
||||
bool API::setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, const hyperion::Components &callerComp)
|
||||
bool API::setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, hyperion::Components callerComp)
|
||||
{
|
||||
// truncate name length
|
||||
data.imgName.truncate(16);
|
||||
@@ -174,7 +174,7 @@ bool API::setImage(ImageCmdData &data, hyperion::Components comp, QString &reply
|
||||
return true;
|
||||
}
|
||||
|
||||
bool API::clearPriority(const int &priority, QString &replyMsg, const hyperion::Components &callerComp)
|
||||
bool API::clearPriority(int priority, QString &replyMsg, hyperion::Components callerComp)
|
||||
{
|
||||
if (priority < 0 || (priority > 0 && priority < 254))
|
||||
{
|
||||
@@ -188,7 +188,7 @@ bool API::clearPriority(const int &priority, QString &replyMsg, const hyperion::
|
||||
return true;
|
||||
}
|
||||
|
||||
bool API::setComponentState(const QString &comp, bool &compState, QString &replyMsg, const hyperion::Components &callerComp)
|
||||
bool API::setComponentState(const QString &comp, bool &compState, QString &replyMsg, hyperion::Components callerComp)
|
||||
{
|
||||
Components component = stringToComponent(comp);
|
||||
|
||||
@@ -201,17 +201,17 @@ bool API::setComponentState(const QString &comp, bool &compState, QString &reply
|
||||
return false;
|
||||
}
|
||||
|
||||
void API::setLedMappingType(const int &type, const hyperion::Components &callerComp)
|
||||
void API::setLedMappingType(int type, hyperion::Components callerComp)
|
||||
{
|
||||
QMetaObject::invokeMethod(_hyperion, "setLedMappingType", Qt::QueuedConnection, Q_ARG(int, type));
|
||||
}
|
||||
|
||||
void API::setVideoMode(const VideoMode &mode, const hyperion::Components &callerComp)
|
||||
void API::setVideoMode(VideoMode mode, hyperion::Components callerComp)
|
||||
{
|
||||
QMetaObject::invokeMethod(_hyperion, "setVideoMode", Qt::QueuedConnection, Q_ARG(VideoMode, mode));
|
||||
}
|
||||
|
||||
void API::setEffect(const EffectCmdData &dat, const hyperion::Components &callerComp)
|
||||
void API::setEffect(const EffectCmdData &dat, hyperion::Components callerComp)
|
||||
{
|
||||
if (!dat.args.isEmpty())
|
||||
{
|
||||
@@ -223,17 +223,17 @@ void API::setEffect(const EffectCmdData &dat, const hyperion::Components &caller
|
||||
}
|
||||
}
|
||||
|
||||
void API::setSourceAutoSelect(const bool state, const hyperion::Components &callerComp)
|
||||
void API::setSourceAutoSelect(bool state, hyperion::Components callerComp)
|
||||
{
|
||||
QMetaObject::invokeMethod(_hyperion, "setSourceAutoSelect", Qt::QueuedConnection, Q_ARG(bool, state));
|
||||
}
|
||||
|
||||
void API::setVisiblePriority(const int &priority, const hyperion::Components &callerComp)
|
||||
void API::setVisiblePriority(int priority, hyperion::Components callerComp)
|
||||
{
|
||||
QMetaObject::invokeMethod(_hyperion, "setVisiblePriority", Qt::QueuedConnection, Q_ARG(int, priority));
|
||||
}
|
||||
|
||||
void API::registerInput(const int &priority, const hyperion::Components &component, const QString &origin, const QString &owner, const hyperion::Components &callerComp)
|
||||
void API::registerInput(int priority, hyperion::Components component, const QString &origin, const QString &owner, hyperion::Components callerComp)
|
||||
{
|
||||
if (_activeRegisters.count(priority))
|
||||
_activeRegisters.erase(priority);
|
||||
@@ -243,13 +243,13 @@ void API::registerInput(const int &priority, const hyperion::Components &compone
|
||||
QMetaObject::invokeMethod(_hyperion, "registerInput", Qt::QueuedConnection, Q_ARG(int, priority), Q_ARG(hyperion::Components, component), Q_ARG(QString, origin), Q_ARG(QString, owner));
|
||||
}
|
||||
|
||||
void API::unregisterInput(const int &priority)
|
||||
void API::unregisterInput(int priority)
|
||||
{
|
||||
if (_activeRegisters.count(priority))
|
||||
_activeRegisters.erase(priority);
|
||||
}
|
||||
|
||||
bool API::setHyperionInstance(const quint8 &inst)
|
||||
bool API::setHyperionInstance(quint8 inst)
|
||||
{
|
||||
if (_currInstanceIndex == inst)
|
||||
return true;
|
||||
@@ -278,19 +278,19 @@ bool API::isHyperionEnabled()
|
||||
return res > 0;
|
||||
}
|
||||
|
||||
QVector<QVariantMap> API::getAllInstanceData(void)
|
||||
QVector<QVariantMap> API::getAllInstanceData()
|
||||
{
|
||||
QVector<QVariantMap> vec;
|
||||
QMetaObject::invokeMethod(_instanceManager, "getInstanceData", Qt::DirectConnection, Q_RETURN_ARG(QVector<QVariantMap>, vec));
|
||||
return vec;
|
||||
}
|
||||
|
||||
void API::startInstance(const quint8 &index)
|
||||
void API::startInstance(quint8 index)
|
||||
{
|
||||
QMetaObject::invokeMethod(_instanceManager, "startInstance", Qt::QueuedConnection, Q_ARG(quint8, index));
|
||||
}
|
||||
|
||||
void API::stopInstance(const quint8 &index)
|
||||
void API::stopInstance(quint8 index)
|
||||
{
|
||||
QMetaObject::invokeMethod(_instanceManager, "stopInstance", Qt::QueuedConnection, Q_ARG(quint8, index));
|
||||
}
|
||||
@@ -302,7 +302,7 @@ void API::requestActiveRegister(QObject *callerInstance)
|
||||
// QMetaObject::invokeMethod(ApiSync::getInstance(), "answerActiveRegister", Qt::QueuedConnection, Q_ARG(QObject *, callerInstance), Q_ARG(MapRegister, _activeRegisters));
|
||||
}
|
||||
|
||||
bool API::deleteInstance(const quint8 &index, QString &replyMsg)
|
||||
bool API::deleteInstance(quint8 index, QString &replyMsg)
|
||||
{
|
||||
if (_adminAuthorized)
|
||||
{
|
||||
@@ -327,7 +327,7 @@ QString API::createInstance(const QString &name)
|
||||
return NO_AUTH;
|
||||
}
|
||||
|
||||
QString API::setInstanceName(const quint8 &index, const QString &name)
|
||||
QString API::setInstanceName(quint8 index, const QString &name)
|
||||
{
|
||||
if (_adminAuthorized)
|
||||
{
|
||||
@@ -417,7 +417,7 @@ void API::cancelNewTokenRequest(const QString &comment, const QString &id)
|
||||
QMetaObject::invokeMethod(_authManager, "cancelNewTokenRequest", Qt::QueuedConnection, Q_ARG(QObject *, this), Q_ARG(QString, comment), Q_ARG(QString, id));
|
||||
}
|
||||
|
||||
bool API::handlePendingTokenRequest(const QString &id, const bool accept)
|
||||
bool API::handlePendingTokenRequest(const QString &id, bool accept)
|
||||
{
|
||||
if (!_adminAuthorized)
|
||||
return false;
|
||||
@@ -503,7 +503,7 @@ void API::logout()
|
||||
stopDataConnectionss();
|
||||
}
|
||||
|
||||
void API::checkTokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id)
|
||||
void API::checkTokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id)
|
||||
{
|
||||
if (this == caller)
|
||||
emit onTokenResponse(success, token, comment, id);
|
||||
|
@@ -47,7 +47,7 @@
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
JsonAPI::JsonAPI(QString peerAddress, Logger *log, const bool &localConnection, QObject *parent, bool noListener)
|
||||
JsonAPI::JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener)
|
||||
: API(log, localConnection, parent)
|
||||
/* , _authManager(AuthManager::getInstance()) // moved to API
|
||||
, _authorized(false)
|
||||
@@ -79,7 +79,7 @@ JsonAPI::JsonAPI(QString peerAddress, Logger *log, const bool &localConnection,
|
||||
Q_INIT_RESOURCE(JSONRPC_schemas);
|
||||
}
|
||||
|
||||
void JsonAPI::initialize(void)
|
||||
void JsonAPI::initialize()
|
||||
{
|
||||
// init API, REQUIRED!
|
||||
API::init();
|
||||
@@ -100,7 +100,7 @@ void JsonAPI::initialize(void)
|
||||
connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
|
||||
}
|
||||
|
||||
bool JsonAPI::handleInstanceSwitch(const quint8 &inst, const bool &forced)
|
||||
bool JsonAPI::handleInstanceSwitch(quint8 inst, bool forced)
|
||||
{
|
||||
if (API::setHyperionInstance(inst))
|
||||
{
|
||||
@@ -211,7 +211,7 @@ proceed:
|
||||
handleNotImplemented();
|
||||
}
|
||||
|
||||
void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
emit forwardJsonMessage(message);
|
||||
int priority = message["priority"].toInt();
|
||||
@@ -230,7 +230,7 @@ void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &comm
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
emit forwardJsonMessage(message);
|
||||
|
||||
@@ -254,7 +254,7 @@ void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &comm
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
emit forwardJsonMessage(message);
|
||||
|
||||
@@ -272,19 +272,19 @@ void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &com
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleCreateEffectCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleCreateEffectCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
const QString resultMsg = API::saveEffect(message);
|
||||
resultMsg.isEmpty() ? sendSuccessReply(command, tan) : sendErrorReply(resultMsg, command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleDeleteEffectCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleDeleteEffectCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
const QString res = API::deleteEffect(message["name"].toString());
|
||||
res.isEmpty() ? sendSuccessReply(command, tan) : sendErrorReply(res, command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, const int tan)
|
||||
void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, int tan)
|
||||
{
|
||||
// create result
|
||||
QJsonObject result;
|
||||
@@ -319,7 +319,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command,
|
||||
emit callbackMessage(result);
|
||||
}
|
||||
|
||||
void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
QJsonObject info;
|
||||
|
||||
@@ -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;
|
||||
@@ -714,7 +714,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleClearCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleClearCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
emit forwardJsonMessage(message);
|
||||
int priority = message["priority"].toInt();
|
||||
@@ -728,7 +728,7 @@ void JsonAPI::handleClearCommand(const QJsonObject &message, const QString &comm
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleClearallCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleClearallCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
emit forwardJsonMessage(message);
|
||||
QString replyMsg;
|
||||
@@ -736,7 +736,7 @@ void JsonAPI::handleClearallCommand(const QJsonObject &message, const QString &c
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
const QJsonObject &adjustment = message["adjustment"].toObject();
|
||||
|
||||
@@ -822,7 +822,7 @@ void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
if (message.contains("auto"))
|
||||
{
|
||||
@@ -840,7 +840,7 @@ void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const QStrin
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
QString subcommand = message["subcommand"].toString("");
|
||||
QString full_command = command + "-" + subcommand;
|
||||
@@ -884,7 +884,7 @@ void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &com
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
if (message.contains("config"))
|
||||
{
|
||||
@@ -899,7 +899,7 @@ void JsonAPI::handleConfigSetCommand(const QJsonObject &message, const QString &
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
// create result
|
||||
QJsonObject schemaJson, alldevices, properties;
|
||||
@@ -962,7 +962,7 @@ void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &
|
||||
sendSuccessDataReply(QJsonDocument(schemaJson), command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
const QJsonObject &componentState = message["componentstate"].toObject();
|
||||
QString comp = componentState["component"].toString("invalid");
|
||||
@@ -977,7 +977,7 @@ void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QStr
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
// create result
|
||||
QString subcommand = message["subcommand"].toString("");
|
||||
@@ -1036,7 +1036,7 @@ void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &
|
||||
sendSuccessReply(command + "-" + subcommand, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleLoggingCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleLoggingCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
// create result
|
||||
QString subcommand = message["subcommand"].toString("");
|
||||
@@ -1078,19 +1078,19 @@ void JsonAPI::handleLoggingCommand(const QJsonObject &message, const QString &co
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleProcessingCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleProcessingCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
API::setLedMappingType(ImageProcessor::mappingTypeToInt(message["mappingType"].toString("multicolor_mean")));
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleVideoModeCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleVideoModeCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
API::setVideoMode(parse3DMode(message["videoMode"].toString("2D")));
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
const QString &subc = message["subcommand"].toString().trimmed();
|
||||
const QString &id = message["id"].toString().trimmed();
|
||||
@@ -1326,7 +1326,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
const QString &subc = message["subcommand"].toString();
|
||||
const quint8 &inst = message["instance"].toInt();
|
||||
@@ -1396,7 +1396,7 @@ void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &c
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &command, const int tan)
|
||||
void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan)
|
||||
{
|
||||
Debug(_log, "message: [%s]", QString(QJsonDocument(message).toJson(QJsonDocument::Compact)).toUtf8().constData() );
|
||||
|
||||
@@ -1457,7 +1457,7 @@ void JsonAPI::handleNotImplemented()
|
||||
sendErrorReply("Command not implemented");
|
||||
}
|
||||
|
||||
void JsonAPI::sendSuccessReply(const QString &command, const int tan)
|
||||
void JsonAPI::sendSuccessReply(const QString &command, int tan)
|
||||
{
|
||||
// create reply
|
||||
QJsonObject reply;
|
||||
@@ -1469,7 +1469,7 @@ void JsonAPI::sendSuccessReply(const QString &command, const int tan)
|
||||
emit callbackMessage(reply);
|
||||
}
|
||||
|
||||
void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, const int &tan)
|
||||
void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, int tan)
|
||||
{
|
||||
QJsonObject reply;
|
||||
reply["success"] = true;
|
||||
@@ -1483,7 +1483,7 @@ void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &comm
|
||||
emit callbackMessage(reply);
|
||||
}
|
||||
|
||||
void JsonAPI::sendErrorReply(const QString &error, const QString &command, const int tan)
|
||||
void JsonAPI::sendErrorReply(const QString &error, const QString &command, int tan)
|
||||
{
|
||||
// create reply
|
||||
QJsonObject reply;
|
||||
@@ -1581,7 +1581,7 @@ void JsonAPI::newPendingTokenRequest(const QString &id, const QString &comment)
|
||||
sendSuccessDataReply(QJsonDocument(obj), "authorize-tokenRequest", 1);
|
||||
}
|
||||
|
||||
void JsonAPI::handleTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id)
|
||||
void JsonAPI::handleTokenResponse(bool success, const QString &token, const QString &comment, const QString &id)
|
||||
{
|
||||
const QString cmd = "authorize-requestToken";
|
||||
QJsonObject result;
|
||||
@@ -1595,7 +1595,7 @@ void JsonAPI::handleTokenResponse(const bool &success, const QString &token, con
|
||||
sendErrorReply("Token request timeout or denied", cmd, 5);
|
||||
}
|
||||
|
||||
void JsonAPI::handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name)
|
||||
void JsonAPI::handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@@ -1610,7 +1610,7 @@ void JsonAPI::handleInstanceStateChange(const InstanceState &state, const quint8
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::stopDataConnections(void)
|
||||
void JsonAPI::stopDataConnections()
|
||||
{
|
||||
LoggerManager::getInstance()->disconnect();
|
||||
_streaming_logging_activated = false;
|
||||
|
@@ -42,7 +42,7 @@ JsonCB::JsonCB(QObject* parent)
|
||||
<< "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "leds-update" << "instance-update" << "token-update";
|
||||
}
|
||||
|
||||
bool JsonCB::subscribeFor(const QString& type, const bool & unsubscribe)
|
||||
bool JsonCB::subscribeFor(const QString& type, bool unsubscribe)
|
||||
{
|
||||
if(!_availableCommands.contains(type))
|
||||
return false;
|
||||
@@ -189,7 +189,7 @@ void JsonCB::doCallback(const QString& cmd, const QVariant& data)
|
||||
emit newCallback(obj);
|
||||
}
|
||||
|
||||
void JsonCB::handleComponentState(const hyperion::Components comp, const bool state)
|
||||
void JsonCB::handleComponentState(hyperion::Components comp, bool state)
|
||||
{
|
||||
QJsonObject data;
|
||||
data["name"] = componentToIdString(comp);
|
||||
@@ -279,7 +279,7 @@ void JsonCB::handlePriorityUpdate()
|
||||
doCallback("priorities-update", QVariant(data));
|
||||
}
|
||||
|
||||
void JsonCB::handleImageToLedsMappingChange(const int& mappingType)
|
||||
void JsonCB::handleImageToLedsMappingChange(int mappingType)
|
||||
{
|
||||
QJsonObject data;
|
||||
data["imageToLedMappingType"] = ImageProcessor::mappingTypeToStr(mappingType);
|
||||
@@ -357,7 +357,7 @@ void JsonCB::handleAdjustmentChange()
|
||||
doCallback("adjustment-update", QVariant(adjustmentArray));
|
||||
}
|
||||
|
||||
void JsonCB::handleVideoModeChange(const VideoMode& mode)
|
||||
void JsonCB::handleVideoModeChange(VideoMode mode)
|
||||
{
|
||||
QJsonObject data;
|
||||
data["videomode"] = QString(videoMode2String(mode));
|
||||
@@ -382,7 +382,7 @@ void JsonCB::handleEffectListChange()
|
||||
doCallback("effects-update", QVariant(effects));
|
||||
}
|
||||
|
||||
void JsonCB::handleSettingsChange(const settings::type& type, const QJsonDocument& data)
|
||||
void JsonCB::handleSettingsChange(settings::type type, const QJsonDocument& data)
|
||||
{
|
||||
QJsonObject dat;
|
||||
if(data.isObject())
|
||||
@@ -393,7 +393,7 @@ void JsonCB::handleSettingsChange(const settings::type& type, const QJsonDocumen
|
||||
doCallback("settings-update", QVariant(dat));
|
||||
}
|
||||
|
||||
void JsonCB::handleLedsConfigChange(const settings::type& type, const QJsonDocument& data)
|
||||
void JsonCB::handleLedsConfigChange(settings::type type, const QJsonDocument& data)
|
||||
{
|
||||
if(type == settings::LEDS)
|
||||
{
|
||||
|
@@ -40,7 +40,7 @@ BlackBorderProcessor::~BlackBorderProcessor()
|
||||
delete _detector;
|
||||
}
|
||||
|
||||
void BlackBorderProcessor::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void BlackBorderProcessor::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::BLACKBORDER)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ void BlackBorderProcessor::handleSettingsUpdate(const settings::type& type, cons
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBorderProcessor::handleCompStateChangeRequest(const hyperion::Components component, bool enable)
|
||||
void BlackBorderProcessor::handleCompStateChangeRequest(hyperion::Components component, bool enable)
|
||||
{
|
||||
if(component == hyperion::COMP_BLACKBORDER)
|
||||
{
|
||||
@@ -88,8 +88,8 @@ void BlackBorderProcessor::handleCompStateChangeRequest(const hyperion::Componen
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBorderProcessor::setHardDisable(const bool& disable) {
|
||||
|
||||
void BlackBorderProcessor::setHardDisable(bool disable)
|
||||
{
|
||||
if (disable)
|
||||
{
|
||||
_enabled = false;
|
||||
|
@@ -23,7 +23,7 @@
|
||||
// project includes
|
||||
#include "BoblightClientConnection.h"
|
||||
|
||||
BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocket *socket, const int priority)
|
||||
BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocket *socket, int priority)
|
||||
: QObject()
|
||||
, _locale(QLocale::C)
|
||||
, _socket(socket)
|
||||
|
@@ -25,7 +25,7 @@ public:
|
||||
/// @param socket The Socket object for this connection
|
||||
/// @param hyperion The Hyperion server
|
||||
///
|
||||
BoblightClientConnection(Hyperion* hyperion, QTcpSocket * socket, const int priority);
|
||||
BoblightClientConnection(Hyperion* hyperion, QTcpSocket * socket, int priority);
|
||||
|
||||
///
|
||||
/// Destructor
|
||||
|
@@ -67,12 +67,12 @@ void BoblightServer::stop()
|
||||
_hyperion->setNewComponentState(COMP_BOBLIGHTSERVER, _server->isListening());
|
||||
}
|
||||
|
||||
bool BoblightServer::active()
|
||||
bool BoblightServer::active() const
|
||||
{
|
||||
return _server->isListening();
|
||||
}
|
||||
|
||||
void BoblightServer::compStateChangeRequest(const hyperion::Components component, bool enable)
|
||||
void BoblightServer::compStateChangeRequest(hyperion::Components component, bool enable)
|
||||
{
|
||||
if (component == COMP_BOBLIGHTSERVER)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ void BoblightServer::closedConnection(BoblightClientConnection *connection)
|
||||
connection->deleteLater();
|
||||
}
|
||||
|
||||
void BoblightServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void BoblightServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::BOBLSERVER)
|
||||
{
|
||||
|
@@ -51,7 +51,7 @@ BonjourServiceRegister::~BonjourServiceRegister()
|
||||
}
|
||||
}
|
||||
|
||||
void BonjourServiceRegister::registerService(const QString& service, const int& port)
|
||||
void BonjourServiceRegister::registerService(const QString& service, int port)
|
||||
{
|
||||
_port = port;
|
||||
// zeroconf $configname@$hostname:port
|
||||
@@ -65,7 +65,7 @@ void BonjourServiceRegister::registerService(const QString& service, const int&
|
||||
);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ EffectFileHandler::EffectFileHandler(const QString& rootPath, const QJsonDocumen
|
||||
handleSettingsUpdate(settings::EFFECTS, effectConfig);
|
||||
}
|
||||
|
||||
void EffectFileHandler::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void EffectFileHandler::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::EFFECTS)
|
||||
{
|
||||
|
@@ -19,10 +19,9 @@ set(Flatbuffer_FBS
|
||||
${CURRENT_SOURCE_DIR}/hyperion_reply.fbs
|
||||
${CURRENT_SOURCE_DIR}/hyperion_request.fbs
|
||||
)
|
||||
|
||||
FOREACH(FBS_FILE ${Flatbuffer_FBS})
|
||||
compile_flattbuffer_schema(${FBS_FILE} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ENDFOREACH(FBS_FILE)
|
||||
compile_flattbuffer_schema(${FBS_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
ENDFOREACH(FBS_FILE)
|
||||
|
||||
# let cmake know about new generated source files
|
||||
set_source_files_properties(
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include <QTimer>
|
||||
#include <QRgb>
|
||||
|
||||
FlatBufferClient::FlatBufferClient(QTcpSocket* socket, const int &timeout, QObject *parent)
|
||||
FlatBufferClient::FlatBufferClient(QTcpSocket* socket, int timeout, QObject *parent)
|
||||
: QObject(parent)
|
||||
, _log(Logger::getInstance("FLATBUFSERVER"))
|
||||
, _socket(socket)
|
||||
@@ -104,7 +104,7 @@ void FlatBufferClient::handleColorCommand(const hyperionnet::Color *colorReq)
|
||||
sendSuccessReply();
|
||||
}
|
||||
|
||||
void FlatBufferClient::registationRequired(const int priority)
|
||||
void FlatBufferClient::registationRequired(int priority)
|
||||
{
|
||||
if (_priority == priority)
|
||||
{
|
||||
|
@@ -30,28 +30,28 @@ public:
|
||||
/// @param timeout The timeout when a client is automatically disconnected and the priority unregistered
|
||||
/// @param parent The parent
|
||||
///
|
||||
explicit FlatBufferClient(QTcpSocket* socket, const int &timeout, QObject *parent = nullptr);
|
||||
explicit FlatBufferClient(QTcpSocket* socket, int timeout, QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief forward register data to HyperionDaemon
|
||||
///
|
||||
void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "FlatBuffer", const QString& owner = "", unsigned smooth_cfg = 0);
|
||||
void registerGlobalInput(int priority, hyperion::Components component, const QString& origin = "FlatBuffer", const QString& owner = "", unsigned smooth_cfg = 0);
|
||||
|
||||
///
|
||||
/// @brief Forward clear command to HyperionDaemon
|
||||
///
|
||||
void clearGlobalInput(const int priority, bool forceClearAll=false);
|
||||
void clearGlobalInput(int priority, bool forceClearAll=false);
|
||||
|
||||
///
|
||||
/// @brief forward prepared image to HyperionDaemon
|
||||
///
|
||||
const bool setGlobalInputImage(const int priority, const Image<ColorRgb>& image, const int timeout_ms, const bool& clearEffect = false);
|
||||
bool setGlobalInputImage(int priority, const Image<ColorRgb>& image, int timeout_ms, bool clearEffect = false);
|
||||
|
||||
///
|
||||
/// @brief Forward requested color
|
||||
///
|
||||
void setGlobalInputColor(const int priority, const std::vector<ColorRgb> &ledColor, const int timeout_ms, const QString& origin = "FlatBuffer" ,bool clearEffects = true);
|
||||
void setGlobalInputColor(int priority, const std::vector<ColorRgb> &ledColor, int timeout_ms, const QString& origin = "FlatBuffer" ,bool clearEffects = true);
|
||||
|
||||
///
|
||||
/// @brief Emits whenever the client disconnected
|
||||
@@ -62,7 +62,7 @@ public slots:
|
||||
///
|
||||
/// @brief Requests a registration from the client
|
||||
///
|
||||
void registationRequired(const int priority);
|
||||
void registationRequired(int priority);
|
||||
|
||||
///
|
||||
/// @brief close the socket and call disconnected()
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include "hyperion_reply_generated.h"
|
||||
#include "hyperion_request_generated.h"
|
||||
|
||||
FlatBufferConnection::FlatBufferConnection(const QString& origin, const QString & address, const int& priority, const bool& skipReply)
|
||||
FlatBufferConnection::FlatBufferConnection(const QString& origin, const QString & address, int priority, bool skipReply)
|
||||
: _socket()
|
||||
, _origin(origin)
|
||||
, _priority(priority)
|
||||
@@ -85,7 +85,7 @@ void FlatBufferConnection::readData()
|
||||
}
|
||||
}
|
||||
|
||||
void FlatBufferConnection::setSkipReply(const bool& skip)
|
||||
void FlatBufferConnection::setSkipReply(bool skip)
|
||||
{
|
||||
if(skip)
|
||||
disconnect(&_socket, &QTcpSocket::readyRead, 0, 0);
|
||||
|
@@ -35,7 +35,7 @@ void FlatBufferServer::initServer()
|
||||
handleSettingsUpdate(settings::FLATBUFSERVER, _config);
|
||||
}
|
||||
|
||||
void FlatBufferServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void FlatBufferServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::FLATBUFSERVER)
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#define VIDEO_DEVICE "/dev/amvideo"
|
||||
#define CAPTURE_DEVICE "/dev/amvideocap0"
|
||||
|
||||
AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height)
|
||||
AmlogicGrabber::AmlogicGrabber(unsigned width, unsigned height)
|
||||
: Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160
|
||||
, _captureDev(-1)
|
||||
, _videoDev(-1)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <grabber/AmlogicWrapper.h>
|
||||
|
||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight)
|
||||
AmlogicWrapper::AmlogicWrapper(unsigned grabWidth, unsigned grabHeight)
|
||||
: GrabberWrapper("AmLogic", &_grabber, grabWidth, grabHeight)
|
||||
, _grabber(grabWidth, grabHeight)
|
||||
{}
|
||||
|
@@ -65,8 +65,6 @@ public:
|
||||
return physicalAddress;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IonBuffer(size_t bufferSize)
|
||||
: bufferSize(bufferSize)
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Local includes
|
||||
#include "grabber/DispmanxFrameGrabber.h"
|
||||
|
||||
DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height)
|
||||
DispmanxFrameGrabber::DispmanxFrameGrabber(unsigned width, unsigned height)
|
||||
: Grabber("DISPMANXGRABBER", 0, 0)
|
||||
, _vc_display(0)
|
||||
, _vc_resource(0)
|
||||
@@ -84,7 +84,7 @@ bool DispmanxFrameGrabber::setWidthHeight(int width, int height)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DispmanxFrameGrabber::setFlags(const int vc_flags)
|
||||
void DispmanxFrameGrabber::setFlags(int vc_flags)
|
||||
{
|
||||
_vc_flags = vc_flags;
|
||||
}
|
||||
|
@@ -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];
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <grabber/DispmanxWrapper.h>
|
||||
|
||||
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz)
|
||||
DispmanxWrapper::DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz)
|
||||
: GrabberWrapper("Dispmanx", &_grabber, grabWidth, grabHeight, updateRate_Hz)
|
||||
, _grabber(grabWidth, grabHeight)
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@
|
||||
// Local includes
|
||||
#include <grabber/FramebufferFrameGrabber.h>
|
||||
|
||||
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height)
|
||||
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, unsigned width, unsigned height)
|
||||
: Grabber("FRAMEBUFFERGRABBER", width, height)
|
||||
, _fbDevice()
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <grabber/FramebufferWrapper.h>
|
||||
|
||||
FramebufferWrapper::FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz)
|
||||
FramebufferWrapper::FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz)
|
||||
: GrabberWrapper("FrameBuffer", &_grabber, grabWidth, grabHeight, updateRate_Hz)
|
||||
, _grabber(device, grabWidth, grabHeight)
|
||||
{}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
// Local includes
|
||||
#include <grabber/OsxFrameGrabber.h>
|
||||
|
||||
OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height)
|
||||
OsxFrameGrabber::OsxFrameGrabber(unsigned display, unsigned width, unsigned height)
|
||||
: Grabber("OSXGRABBER", width, height)
|
||||
, _screenIndex(100)
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <grabber/OsxWrapper.h>
|
||||
|
||||
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz)
|
||||
OsxWrapper::OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz)
|
||||
: GrabberWrapper("OSX FrameGrabber", &_grabber, grabWidth, grabHeight, updateRate_Hz)
|
||||
, _grabber(display, grabWidth, grabHeight)
|
||||
{}
|
||||
|
@@ -116,7 +116,7 @@ int QtGrabber::grabFrame(Image<ColorRgb> & image)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QtGrabber::updateScreenDimensions(const bool& force)
|
||||
int QtGrabber::updateScreenDimensions(bool force)
|
||||
{
|
||||
if(!_screen)
|
||||
return -1;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <grabber/QtWrapper.h>
|
||||
|
||||
QtWrapper::QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz)
|
||||
QtWrapper::QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, unsigned updateRate_Hz)
|
||||
: GrabberWrapper("Qt", &_grabber, 0, 0, updateRate_Hz)
|
||||
, _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation, display)
|
||||
{}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void V4L2Wrapper::handleCecEvent(CECEvent event)
|
||||
_grabber.handleCecEvent(event);
|
||||
}
|
||||
|
||||
void V4L2Wrapper::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void V4L2Wrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::V4L2 && _grabberName.startsWith("V4L"))
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <grabber/X11Wrapper.h>
|
||||
|
||||
X11Wrapper::X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz)
|
||||
X11Wrapper::X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, unsigned updateRate_Hz)
|
||||
: GrabberWrapper("X11", &_grabber, 0, 0, updateRate_Hz)
|
||||
, _grabber(cropLeft, cropRight, cropTop, cropBottom, pixelDecimation)
|
||||
, _init(false)
|
||||
|
@@ -86,7 +86,7 @@ void XcbGrabber::setupResources()
|
||||
if(_XcbShmAvailable)
|
||||
{
|
||||
_shminfo = xcb_generate_id(_connection);
|
||||
int id = shmget(IPC_PRIVATE, _width * _height * 4, IPC_CREAT | 0777);
|
||||
int id = shmget(IPC_PRIVATE, size_t(_width) * size_t(_height) * 4, IPC_CREAT | 0777);
|
||||
_shmData = static_cast<uint8_t*>(shmat(id, nullptr, 0));
|
||||
xcb_shm_attach(_connection, _shminfo, id, 0);
|
||||
}
|
||||
|
@@ -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,13 +79,13 @@ 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));
|
||||
}
|
||||
|
||||
void AuthManager::setAuthBlock(const bool &user)
|
||||
void AuthManager::setAuthBlock(bool user)
|
||||
{
|
||||
// current timestamp +10 minutes
|
||||
if (user)
|
||||
@@ -172,7 +172,7 @@ void AuthManager::cancelNewTokenRequest(QObject *caller, const QString &comment,
|
||||
}
|
||||
}
|
||||
|
||||
void AuthManager::handlePendingTokenRequest(const QString &id, const bool &accept)
|
||||
void AuthManager::handlePendingTokenRequest(const QString &id, bool accept)
|
||||
{
|
||||
if (_pendingRequests.contains(id))
|
||||
{
|
||||
@@ -192,7 +192,7 @@ void AuthManager::handlePendingTokenRequest(const QString &id, const bool &accep
|
||||
}
|
||||
}
|
||||
|
||||
QVector<AuthManager::AuthDefinition> AuthManager::getPendingRequests()
|
||||
QVector<AuthManager::AuthDefinition> AuthManager::getPendingRequests() const
|
||||
{
|
||||
QVector<AuthManager::AuthDefinition> finalVec;
|
||||
for (const auto &entry : _pendingRequests)
|
||||
@@ -226,7 +226,7 @@ bool AuthManager::deleteToken(const QString &id)
|
||||
return false;
|
||||
}
|
||||
|
||||
void AuthManager::handleSettingsUpdate(const settings::type &type, const QJsonDocument &config)
|
||||
void AuthManager::handleSettingsUpdate(settings::type type, const QJsonDocument &config)
|
||||
{
|
||||
if (type == settings::NETWORK)
|
||||
{
|
||||
|
@@ -63,7 +63,7 @@ void CaptureCont::handleSystemImage(const QString& name, const Image<ColorRgb>&
|
||||
_hyperion->setInputImage(_systemCaptPrio, image);
|
||||
}
|
||||
|
||||
void CaptureCont::setSystemCaptureEnable(const bool& enable)
|
||||
void CaptureCont::setSystemCaptureEnable(bool enable)
|
||||
{
|
||||
if(_systemCaptEnabled != enable)
|
||||
{
|
||||
@@ -86,7 +86,7 @@ void CaptureCont::setSystemCaptureEnable(const bool& enable)
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureCont::setV4LCaptureEnable(const bool& enable)
|
||||
void CaptureCont::setV4LCaptureEnable(bool enable)
|
||||
{
|
||||
if(_v4lCaptEnabled != enable)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ void CaptureCont::setV4LCaptureEnable(const bool& enable)
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureCont::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void CaptureCont::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::INSTCAPTURE)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ void CaptureCont::handleSettingsUpdate(const settings::type& type, const QJsonDo
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureCont::handleCompStateChangeRequest(const hyperion::Components component, bool enable)
|
||||
void CaptureCont::handleCompStateChangeRequest(hyperion::Components component, bool enable)
|
||||
{
|
||||
if(component == hyperion::COMP_GRABBER)
|
||||
{
|
||||
|
@@ -24,12 +24,12 @@ ComponentRegister::~ComponentRegister()
|
||||
{
|
||||
}
|
||||
|
||||
int ComponentRegister::isComponentEnabled(const hyperion::Components& comp) const
|
||||
int ComponentRegister::isComponentEnabled(hyperion::Components comp) const
|
||||
{
|
||||
return (_componentStates.count(comp)) ? _componentStates.at(comp) : -1;
|
||||
}
|
||||
|
||||
void ComponentRegister::setNewComponentState(const hyperion::Components comp, const bool activated)
|
||||
void ComponentRegister::setNewComponentState(hyperion::Components comp, bool activated)
|
||||
{
|
||||
if(_componentStates[comp] != activated)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ void ComponentRegister::setNewComponentState(const hyperion::Components comp, co
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentRegister::handleCompStateChangeRequest(const hyperion::Components comps, const bool activated)
|
||||
void ComponentRegister::handleCompStateChangeRequest(hyperion::Components comps, bool activated)
|
||||
{
|
||||
if(comps == COMP_ALL && !_inProgress)
|
||||
{
|
||||
|
@@ -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)
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
GrabberWrapper* GrabberWrapper::instance = nullptr;
|
||||
|
||||
GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const 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)
|
||||
@@ -39,7 +39,6 @@ GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned
|
||||
|
||||
GrabberWrapper::~GrabberWrapper()
|
||||
{
|
||||
stop();
|
||||
Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName));
|
||||
}
|
||||
|
||||
@@ -105,7 +104,7 @@ QStringList GrabberWrapper::availableGrabbers()
|
||||
return grabbers;
|
||||
}
|
||||
|
||||
void GrabberWrapper::setVideoMode(const VideoMode& mode)
|
||||
void GrabberWrapper::setVideoMode(VideoMode mode)
|
||||
{
|
||||
if (_ggrabber != nullptr)
|
||||
{
|
||||
@@ -134,7 +133,7 @@ void GrabberWrapper::updateTimer(int interval)
|
||||
}
|
||||
}
|
||||
|
||||
void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void GrabberWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::SYSTEMCAPTURE && !_grabberName.startsWith("V4L"))
|
||||
{
|
||||
@@ -165,7 +164,7 @@ void GrabberWrapper::handleSettingsUpdate(const settings::type& type, const QJso
|
||||
}
|
||||
}
|
||||
|
||||
void GrabberWrapper::handleSourceRequest(const hyperion::Components& component, const int hyperionInd, const bool listen)
|
||||
void GrabberWrapper::handleSourceRequest(hyperion::Components component, int hyperionInd, bool listen)
|
||||
{
|
||||
if(component == hyperion::Components::COMP_GRABBER && !_grabberName.startsWith("V4L"))
|
||||
{
|
||||
@@ -202,7 +201,7 @@ void GrabberWrapper::tryStart()
|
||||
}
|
||||
}
|
||||
|
||||
QStringList GrabberWrapper::getV4L2devices()
|
||||
QStringList GrabberWrapper::getV4L2devices() const
|
||||
{
|
||||
if(_grabberName.startsWith("V4L"))
|
||||
return _ggrabber->getV4L2devices();
|
||||
@@ -210,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);
|
||||
@@ -218,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);
|
||||
@@ -226,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);
|
||||
@@ -234,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);
|
||||
|
@@ -39,7 +39,7 @@
|
||||
// Boblight
|
||||
#include <boblightserver/BoblightServer.h>
|
||||
|
||||
Hyperion::Hyperion(const quint8& instance)
|
||||
Hyperion::Hyperion(quint8 instance)
|
||||
: QObject()
|
||||
, _instIndex(instance)
|
||||
, _settingsManager(new SettingsManager(instance, this))
|
||||
@@ -166,7 +166,7 @@ void Hyperion::freeObjects()
|
||||
delete _ledDeviceWrapper;
|
||||
}
|
||||
|
||||
void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void Hyperion::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
// std::cout << "Hyperion::handleSettingsUpdate" << std::endl;
|
||||
// std::cout << config.toJson().toStdString() << std::endl;
|
||||
@@ -250,12 +250,12 @@ void Hyperion::handleSettingsUpdate(const settings::type& type, const QJsonDocum
|
||||
update();
|
||||
}
|
||||
|
||||
QJsonDocument Hyperion::getSetting(const settings::type& type) const
|
||||
QJsonDocument Hyperion::getSetting(settings::type type) const
|
||||
{
|
||||
return _settingsManager->getSetting(type);
|
||||
}
|
||||
|
||||
bool Hyperion::saveSettings(QJsonObject config, const bool& correct)
|
||||
bool Hyperion::saveSettings(const QJsonObject& config, bool correct)
|
||||
{
|
||||
return _settingsManager->saveSettings(config, correct);
|
||||
}
|
||||
@@ -280,22 +280,22 @@ unsigned Hyperion::getLedCount() const
|
||||
return _ledString.leds().size();
|
||||
}
|
||||
|
||||
void Hyperion::setSourceAutoSelect(const bool state)
|
||||
void Hyperion::setSourceAutoSelect(bool state)
|
||||
{
|
||||
_muxer.setSourceAutoSelectEnabled(state);
|
||||
}
|
||||
|
||||
bool Hyperion::setVisiblePriority(const int& priority)
|
||||
bool Hyperion::setVisiblePriority(int priority)
|
||||
{
|
||||
return _muxer.setPriority(priority);
|
||||
}
|
||||
|
||||
bool Hyperion::sourceAutoSelectEnabled()
|
||||
bool Hyperion::sourceAutoSelectEnabled() const
|
||||
{
|
||||
return _muxer.isSourceAutoSelectEnabled();
|
||||
}
|
||||
|
||||
void Hyperion::setNewComponentState(const hyperion::Components& component, const bool& state)
|
||||
void Hyperion::setNewComponentState(hyperion::Components component, bool state)
|
||||
{
|
||||
_componentRegister.setNewComponentState(component, state);
|
||||
}
|
||||
@@ -305,17 +305,17 @@ std::map<hyperion::Components, bool> Hyperion::getAllComponents() const
|
||||
return _componentRegister.getRegister();
|
||||
}
|
||||
|
||||
int Hyperion::isComponentEnabled(const hyperion::Components &comp)
|
||||
int Hyperion::isComponentEnabled(hyperion::Components comp) const
|
||||
{
|
||||
return _componentRegister.isComponentEnabled(comp);
|
||||
}
|
||||
|
||||
void Hyperion::registerInput(const int priority, const hyperion::Components& component, const QString& origin, const QString& owner, unsigned smooth_cfg)
|
||||
void Hyperion::registerInput(int priority, hyperion::Components component, const QString& origin, const QString& owner, unsigned smooth_cfg)
|
||||
{
|
||||
_muxer.registerInput(priority, component, origin, owner, smooth_cfg);
|
||||
}
|
||||
|
||||
bool Hyperion::setInput(const int priority, const std::vector<ColorRgb>& ledColors, int timeout_ms, const bool& clearEffect)
|
||||
bool Hyperion::setInput(int priority, const std::vector<ColorRgb>& ledColors, int timeout_ms, bool clearEffect)
|
||||
{
|
||||
if(_muxer.setInput(priority, ledColors, timeout_ms))
|
||||
{
|
||||
@@ -334,7 +334,7 @@ bool Hyperion::setInput(const int priority, const std::vector<ColorRgb>& ledColo
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Hyperion::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms, const bool& clearEffect)
|
||||
bool Hyperion::setInputImage(int priority, const Image<ColorRgb>& image, int64_t timeout_ms, bool clearEffect)
|
||||
{
|
||||
if (!_muxer.hasPriority(priority))
|
||||
{
|
||||
@@ -359,12 +359,12 @@ bool Hyperion::setInputImage(const int priority, const Image<ColorRgb>& image, i
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Hyperion::setInputInactive(const quint8& priority)
|
||||
bool Hyperion::setInputInactive(quint8 priority)
|
||||
{
|
||||
return _muxer.setInputInactive(priority);
|
||||
}
|
||||
|
||||
void Hyperion::setColor(const int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms, const QString &origin, bool clearEffects)
|
||||
void Hyperion::setColor(int priority, const std::vector<ColorRgb> &ledColors, int timeout_ms, const QString &origin, bool clearEffects)
|
||||
{
|
||||
// clear effect if this call does not come from an effect
|
||||
if (clearEffects)
|
||||
@@ -396,7 +396,7 @@ end:
|
||||
_muxer.queuePush();
|
||||
}
|
||||
|
||||
const QStringList & Hyperion::getAdjustmentIds() const
|
||||
QStringList Hyperion::getAdjustmentIds() const
|
||||
{
|
||||
return _raw2ledAdjustment->getAdjustmentIds();
|
||||
}
|
||||
@@ -412,7 +412,7 @@ void Hyperion::adjustmentsUpdated()
|
||||
update();
|
||||
}
|
||||
|
||||
bool Hyperion::clear(const int priority, bool forceClearAll)
|
||||
bool Hyperion::clear(int priority, bool forceClearAll)
|
||||
{
|
||||
if (priority < 0)
|
||||
{
|
||||
@@ -439,7 +439,7 @@ int Hyperion::getCurrentPriority() const
|
||||
return _muxer.getCurrentPriority();
|
||||
}
|
||||
|
||||
bool Hyperion::isCurrentPriority(const int priority) const
|
||||
bool Hyperion::isCurrentPriority(int priority) const
|
||||
{
|
||||
return getCurrentPriority() == priority;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ QList<int> Hyperion::getActivePriorities() const
|
||||
return _muxer.getPriorities();
|
||||
}
|
||||
|
||||
Hyperion::InputInfo Hyperion::getPriorityInfo(const int priority) const
|
||||
Hyperion::InputInfo Hyperion::getPriorityInfo(int priority) const
|
||||
{
|
||||
return _muxer.getInputInfo(priority);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -494,7 +494,7 @@ int Hyperion::setEffect(const QString &effectName, const QJsonObject &args, int
|
||||
return _effectEngine->runEffect(effectName, args, priority, timeout, pythonScript, origin, 0, imageData);
|
||||
}
|
||||
|
||||
void Hyperion::setLedMappingType(const int& mappingType)
|
||||
void Hyperion::setLedMappingType(int mappingType)
|
||||
{
|
||||
if(mappingType != _imageProcessor->getUserLedMappingType())
|
||||
{
|
||||
@@ -508,7 +508,7 @@ int Hyperion::getLedMappingType() const
|
||||
return _imageProcessor->getUserLedMappingType();
|
||||
}
|
||||
|
||||
void Hyperion::setVideoMode(const VideoMode& mode)
|
||||
void Hyperion::setVideoMode(VideoMode mode)
|
||||
{
|
||||
emit videoMode(mode);
|
||||
}
|
||||
@@ -523,7 +523,7 @@ QString Hyperion::getActiveDeviceType() const
|
||||
return _ledDeviceWrapper->getActiveDeviceType();
|
||||
}
|
||||
|
||||
void Hyperion::handleVisibleComponentChanged(const hyperion::Components &comp)
|
||||
void Hyperion::handleVisibleComponentChanged(hyperion::Components comp)
|
||||
{
|
||||
_imageProcessor->setBlackbarDetectDisable((comp == hyperion::COMP_EFFECT));
|
||||
_imageProcessor->setHardLedMappingType((comp == hyperion::COMP_EFFECT) ? 0 : -1);
|
||||
|
@@ -19,7 +19,7 @@ HyperionIManager::HyperionIManager(const QString& rootPath, QObject* parent)
|
||||
qRegisterMetaType<InstanceState>("InstanceState");
|
||||
}
|
||||
|
||||
Hyperion* HyperionIManager::getHyperionInstance(const quint8& instance)
|
||||
Hyperion* HyperionIManager::getHyperionInstance(quint8 instance)
|
||||
{
|
||||
if(_runningInstances.contains(instance))
|
||||
return _runningInstances.value(instance);
|
||||
@@ -28,7 +28,7 @@ Hyperion* HyperionIManager::getHyperionInstance(const 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)
|
||||
@@ -57,7 +57,7 @@ void HyperionIManager::stopAll()
|
||||
}
|
||||
}
|
||||
|
||||
void HyperionIManager::toggleStateAllInstances(const bool& pause)
|
||||
void HyperionIManager::toggleStateAllInstances(bool pause)
|
||||
{
|
||||
// copy the instances due to loop corruption, even with .erase() return next iter
|
||||
QMap<quint8, Hyperion*> instCopy = _runningInstances;
|
||||
@@ -67,7 +67,7 @@ void HyperionIManager::toggleStateAllInstances(const bool& pause)
|
||||
}
|
||||
}
|
||||
|
||||
bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
|
||||
bool HyperionIManager::startInstance(quint8 inst, bool block)
|
||||
{
|
||||
if(_instanceTable->instanceExist(inst))
|
||||
{
|
||||
@@ -113,7 +113,7 @@ bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HyperionIManager::stopInstance(const quint8& inst)
|
||||
bool HyperionIManager::stopInstance(quint8 inst)
|
||||
{
|
||||
// inst 0 can't be stopped
|
||||
if(!isInstAllowed(inst))
|
||||
@@ -140,7 +140,7 @@ bool HyperionIManager::stopInstance(const quint8& inst)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HyperionIManager::createInstance(const QString& name, const bool& start)
|
||||
bool HyperionIManager::createInstance(const QString& name, bool start)
|
||||
{
|
||||
quint8 inst;
|
||||
if(_instanceTable->createInstance(name, inst))
|
||||
@@ -156,7 +156,7 @@ bool HyperionIManager::createInstance(const QString& name, const bool& start)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HyperionIManager::deleteInstance(const quint8& inst)
|
||||
bool HyperionIManager::deleteInstance(quint8 inst)
|
||||
{
|
||||
// inst 0 can't be deleted
|
||||
if(!isInstAllowed(inst))
|
||||
@@ -176,7 +176,7 @@ bool HyperionIManager::deleteInstance(const quint8& inst)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HyperionIManager::saveName(const quint8& inst, const QString& name)
|
||||
bool HyperionIManager::saveName(quint8 inst, const QString& name)
|
||||
{
|
||||
if(_instanceTable->saveName(inst, name))
|
||||
{
|
||||
@@ -189,7 +189,7 @@ bool HyperionIManager::saveName(const quint8& inst, const QString& name)
|
||||
void HyperionIManager::handleFinished()
|
||||
{
|
||||
Hyperion* hyperion = qobject_cast<Hyperion*>(sender());
|
||||
const quint8 & instance = hyperion->getInstanceIndex();
|
||||
quint8 instance = hyperion->getInstanceIndex();
|
||||
|
||||
Info(_log,"Hyperion instance '%s' has been stopped", QSTRING_CSTR(_instanceTable->getNamebyIndex(instance)));
|
||||
|
||||
@@ -203,7 +203,7 @@ void HyperionIManager::handleFinished()
|
||||
void HyperionIManager::handleStarted()
|
||||
{
|
||||
Hyperion* hyperion = qobject_cast<Hyperion*>(sender());
|
||||
const quint8 & instance = hyperion->getInstanceIndex();
|
||||
quint8 instance = hyperion->getInstanceIndex();
|
||||
|
||||
Info(_log,"Hyperion instance '%s' has been started", QSTRING_CSTR(_instanceTable->getNamebyIndex(instance)));
|
||||
|
||||
|
@@ -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;
|
||||
@@ -48,7 +48,7 @@ ImageProcessor::~ImageProcessor()
|
||||
delete _imageToLeds;
|
||||
}
|
||||
|
||||
void ImageProcessor::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void ImageProcessor::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::COLOR)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ void ImageProcessor::handleSettingsUpdate(const settings::type& type, const QJso
|
||||
}
|
||||
}
|
||||
|
||||
void ImageProcessor::setSize(const unsigned width, const unsigned height)
|
||||
void ImageProcessor::setSize(unsigned width, unsigned height)
|
||||
{
|
||||
// Check if the existing buffer-image is already the correct dimensions
|
||||
if (_imageToLeds && _imageToLeds->width() == width && _imageToLeds->height() == height)
|
||||
@@ -99,7 +99,7 @@ void ImageProcessor::setBlackbarDetectDisable(bool enable)
|
||||
_borderProcessor->setHardDisable(enable);
|
||||
}
|
||||
|
||||
bool ImageProcessor::blackBorderDetectorEnabled()
|
||||
bool ImageProcessor::blackBorderDetectorEnabled() const
|
||||
{
|
||||
return _borderProcessor->enabled();
|
||||
}
|
||||
|
@@ -3,10 +3,10 @@
|
||||
using namespace hyperion;
|
||||
|
||||
ImageToLedsMap::ImageToLedsMap(
|
||||
const unsigned width,
|
||||
const unsigned height,
|
||||
const unsigned horizontalBorder,
|
||||
const unsigned verticalBorder,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
unsigned horizontalBorder,
|
||||
unsigned verticalBorder,
|
||||
const std::vector<Led>& leds)
|
||||
: _width(width)
|
||||
, _height(height)
|
||||
|
@@ -43,7 +43,7 @@ LinearColorSmoothing::LinearColorSmoothing(const QJsonDocument& config, Hyperion
|
||||
connect(_timer, &QTimer::timeout, this, &LinearColorSmoothing::updateLeds);
|
||||
}
|
||||
|
||||
void LinearColorSmoothing::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void LinearColorSmoothing::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::SMOOTHING)
|
||||
{
|
||||
@@ -198,7 +198,7 @@ void LinearColorSmoothing::clearQueuedColors()
|
||||
_targetValues.clear();
|
||||
}
|
||||
|
||||
void LinearColorSmoothing::componentStateChange(const hyperion::Components component, const bool state)
|
||||
void LinearColorSmoothing::componentStateChange(hyperion::Components component, bool state)
|
||||
{
|
||||
_writeToLedsEnable = state;
|
||||
if(component == hyperion::COMP_LEDDEVICE)
|
||||
@@ -254,7 +254,7 @@ unsigned LinearColorSmoothing::updateConfig(unsigned cfgID, int settlingTime_ms,
|
||||
return updatedCfgID;
|
||||
}
|
||||
|
||||
bool LinearColorSmoothing::selectConfig(unsigned cfg, const bool& force)
|
||||
bool LinearColorSmoothing::selectConfig(unsigned cfg, bool force)
|
||||
{
|
||||
if (_currentConfigId == cfg && !force)
|
||||
{
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
///
|
||||
/// @return On success return else false (and falls back to cfg 0)
|
||||
///
|
||||
bool selectConfig(unsigned cfg, const bool& force = false);
|
||||
bool selectConfig(unsigned cfg, bool force = false);
|
||||
|
||||
public slots:
|
||||
///
|
||||
@@ -82,7 +82,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);
|
||||
|
||||
private slots:
|
||||
/// Timer callback which writes updated led values to the led device
|
||||
@@ -93,7 +93,7 @@ private slots:
|
||||
/// @param component The component
|
||||
/// @param state The requested state
|
||||
///
|
||||
void componentStateChange(const hyperion::Components component, const bool state);
|
||||
void componentStateChange(hyperion::Components component, bool state);
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -43,7 +43,7 @@ MessageForwarder::~MessageForwarder()
|
||||
delete _forwardClients.takeFirst();
|
||||
}
|
||||
|
||||
void MessageForwarder::handleSettingsUpdate(const settings::type &type, const QJsonDocument &config)
|
||||
void MessageForwarder::handleSettingsUpdate(settings::type type, const QJsonDocument &config)
|
||||
{
|
||||
if(type == settings::NETFORWARD)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ void MessageForwarder::handleSettingsUpdate(const settings::type &type, const QJ
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::handleCompStateChangeRequest(const hyperion::Components component, bool enable)
|
||||
void MessageForwarder::handleCompStateChangeRequest(hyperion::Components component, bool enable)
|
||||
{
|
||||
if (component == hyperion::COMP_FORWARDER && _forwarder_enabled != enable)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ void MessageForwarder::handleCompStateChangeRequest(const hyperion::Components c
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::handlePriorityChanges(const quint8 &priority)
|
||||
void MessageForwarder::handlePriorityChanges(quint8 priority)
|
||||
{
|
||||
const QJsonObject obj = _hyperion->getSetting(settings::NETFORWARD).object();
|
||||
if (priority != 0 && _forwarder_enabled && obj["enable"].toBool())
|
||||
@@ -156,7 +156,7 @@ void MessageForwarder::handlePriorityChanges(const 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)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/MultiColorAdjustment.h>
|
||||
|
||||
MultiColorAdjustment::MultiColorAdjustment(const unsigned ledCnt)
|
||||
MultiColorAdjustment::MultiColorAdjustment(unsigned ledCnt)
|
||||
: _ledAdjustments(ledCnt, nullptr)
|
||||
, _log(Logger::getInstance("ADJUSTMENT"))
|
||||
{
|
||||
@@ -25,7 +25,7 @@ void MultiColorAdjustment::addAdjustment(ColorAdjustment * adjustment)
|
||||
_adjustment.push_back(adjustment);
|
||||
}
|
||||
|
||||
void MultiColorAdjustment::setAdjustmentForLed(const QString& id, const unsigned startLed, unsigned endLed)
|
||||
void MultiColorAdjustment::setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed)
|
||||
{
|
||||
// abort
|
||||
if(startLed > endLed)
|
||||
@@ -67,7 +67,7 @@ bool MultiColorAdjustment::verifyAdjustments() const
|
||||
return ok;
|
||||
}
|
||||
|
||||
const QStringList & MultiColorAdjustment::getAdjustmentIds()
|
||||
QStringList MultiColorAdjustment::getAdjustmentIds() const
|
||||
{
|
||||
return _adjustmentIds;
|
||||
}
|
||||
|
@@ -55,12 +55,12 @@ PriorityMuxer::~PriorityMuxer()
|
||||
{
|
||||
}
|
||||
|
||||
void PriorityMuxer::setEnable(const bool& enable)
|
||||
void PriorityMuxer::setEnable(bool enable)
|
||||
{
|
||||
enable ? _updateTimer->start() : _updateTimer->stop();
|
||||
}
|
||||
|
||||
bool PriorityMuxer::setSourceAutoSelectEnabled(const bool& enable, const bool& update)
|
||||
bool PriorityMuxer::setSourceAutoSelectEnabled(bool enable, bool update)
|
||||
{
|
||||
if(_sourceAutoSelectEnabled != enable)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ bool PriorityMuxer::setSourceAutoSelectEnabled(const bool& enable, const bool& u
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PriorityMuxer::setPriority(const uint8_t priority)
|
||||
bool PriorityMuxer::setPriority(uint8_t priority)
|
||||
{
|
||||
if(_activeInputs.contains(priority))
|
||||
{
|
||||
@@ -96,7 +96,7 @@ bool PriorityMuxer::setPriority(const uint8_t priority)
|
||||
return false;
|
||||
}
|
||||
|
||||
void PriorityMuxer::updateLedColorsLength(const int& ledCount)
|
||||
void PriorityMuxer::updateLedColorsLength(int ledCount)
|
||||
{
|
||||
for (auto infoIt = _activeInputs.begin(); infoIt != _activeInputs.end();)
|
||||
{
|
||||
@@ -113,12 +113,12 @@ QList<int> PriorityMuxer::getPriorities() const
|
||||
return _activeInputs.keys();
|
||||
}
|
||||
|
||||
bool PriorityMuxer::hasPriority(const int priority) const
|
||||
bool PriorityMuxer::hasPriority(int priority) const
|
||||
{
|
||||
return (priority == PriorityMuxer::LOWEST_PRIORITY) ? true : _activeInputs.contains(priority);
|
||||
}
|
||||
|
||||
const PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(const int priority) const
|
||||
PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(int priority) const
|
||||
{
|
||||
auto elemIt = _activeInputs.find(priority);
|
||||
if (elemIt == _activeInputs.end())
|
||||
@@ -133,12 +133,12 @@ const PriorityMuxer::InputInfo PriorityMuxer::getInputInfo(const int priority) c
|
||||
return elemIt.value();
|
||||
}
|
||||
|
||||
hyperion::Components PriorityMuxer::getComponentOfPriority(const int &priority)
|
||||
hyperion::Components PriorityMuxer::getComponentOfPriority(int priority) const
|
||||
{
|
||||
return _activeInputs[priority].componentId;
|
||||
}
|
||||
|
||||
void PriorityMuxer::registerInput(const int priority, const hyperion::Components& component, const QString& origin, const QString& owner, unsigned smooth_cfg)
|
||||
void PriorityMuxer::registerInput(int priority, hyperion::Components component, const QString& origin, const QString& owner, unsigned smooth_cfg)
|
||||
{
|
||||
// detect new registers
|
||||
bool newInput = false;
|
||||
@@ -162,7 +162,7 @@ void PriorityMuxer::registerInput(const int priority, const hyperion::Components
|
||||
}
|
||||
}
|
||||
|
||||
bool PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms)
|
||||
bool PriorityMuxer::setInput(int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms)
|
||||
{
|
||||
if(!_activeInputs.contains(priority))
|
||||
{
|
||||
@@ -202,7 +202,7 @@ bool PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& le
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms)
|
||||
bool PriorityMuxer::setInputImage(int priority, const Image<ColorRgb>& image, int64_t timeout_ms)
|
||||
{
|
||||
if(!_activeInputs.contains(priority))
|
||||
{
|
||||
@@ -242,13 +242,13 @@ bool PriorityMuxer::setInputImage(const int priority, const Image<ColorRgb>& ima
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PriorityMuxer::setInputInactive(const quint8& priority)
|
||||
bool PriorityMuxer::setInputInactive(quint8 priority)
|
||||
{
|
||||
Image<ColorRgb> image;
|
||||
return setInputImage(priority, image, -100);
|
||||
}
|
||||
|
||||
bool PriorityMuxer::clearInput(const uint8_t priority)
|
||||
bool PriorityMuxer::clearInput(uint8_t priority)
|
||||
{
|
||||
if (priority < PriorityMuxer::LOWEST_PRIORITY && _activeInputs.remove(priority))
|
||||
{
|
||||
@@ -283,7 +283,7 @@ void PriorityMuxer::clearAll(bool forceClearAll)
|
||||
}
|
||||
}
|
||||
|
||||
void PriorityMuxer::setCurrentTime(void)
|
||||
void PriorityMuxer::setCurrentTime()
|
||||
{
|
||||
const int64_t now = QDateTime::currentMSecsSinceEpoch();
|
||||
int newPriority;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
QJsonObject SettingsManager::schemaJson;
|
||||
|
||||
SettingsManager::SettingsManager(const quint8& instance, QObject* parent)
|
||||
SettingsManager::SettingsManager(quint8 instance, QObject* parent)
|
||||
: QObject(parent)
|
||||
, _log(Logger::getInstance("SETTINGSMGR"))
|
||||
, _sTable(new SettingsTable(instance, this))
|
||||
@@ -107,12 +107,12 @@ SettingsManager::SettingsManager(const quint8& instance, QObject* parent)
|
||||
Debug(_log,"Settings database initialized");
|
||||
}
|
||||
|
||||
const QJsonDocument SettingsManager::getSetting(const settings::type& type)
|
||||
QJsonDocument SettingsManager::getSetting(settings::type type) const
|
||||
{
|
||||
return _sTable->getSettingsRecord(settings::typeToString(type));
|
||||
}
|
||||
|
||||
bool SettingsManager::saveSettings(QJsonObject config, const bool& correct)
|
||||
bool SettingsManager::saveSettings(QJsonObject config, bool correct)
|
||||
{
|
||||
// optional data upgrades e.g. imported legacy/older configs
|
||||
// handleConfigUpgrade(config);
|
||||
@@ -130,7 +130,7 @@ bool SettingsManager::saveSettings(QJsonObject config, const 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));
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include <QTcpSocket>
|
||||
#include <QHostAddress>
|
||||
|
||||
JsonClientConnection::JsonClientConnection(QTcpSocket *socket, const bool& localConnection)
|
||||
JsonClientConnection::JsonClientConnection(QTcpSocket *socket, bool localConnection)
|
||||
: QObject()
|
||||
, _socket(socket)
|
||||
, _receiveBuffer()
|
||||
@@ -53,7 +53,7 @@ qint64 JsonClientConnection::sendMessage(QJsonObject message)
|
||||
return _socket->write(data.data(), data.size());
|
||||
}
|
||||
|
||||
void JsonClientConnection::disconnected(void)
|
||||
void JsonClientConnection::disconnected()
|
||||
{
|
||||
emit connectionClosed();
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ public:
|
||||
/// Constructor
|
||||
/// @param socket The Socket object for this connection
|
||||
///
|
||||
JsonClientConnection(QTcpSocket * socket, const bool& localConnection);
|
||||
JsonClientConnection(QTcpSocket * socket, bool localConnection);
|
||||
|
||||
signals:
|
||||
void connectionClosed();
|
||||
|
@@ -73,7 +73,7 @@ void JsonServer::stop()
|
||||
Info(_log, "Stopped");
|
||||
}
|
||||
|
||||
void JsonServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
|
||||
void JsonServer::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::JSONSERVER)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ void JsonServer::newConnection()
|
||||
}
|
||||
}
|
||||
|
||||
void JsonServer::closedConnection(void)
|
||||
void JsonServer::closedConnection()
|
||||
{
|
||||
JsonClientConnection* connection = qobject_cast<JsonClientConnection*>(sender());
|
||||
Debug(_log, "Connection closed");
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -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,12 +146,12 @@ unsigned int LedDeviceWrapper::getLedCount() const
|
||||
return value;
|
||||
}
|
||||
|
||||
bool LedDeviceWrapper::enabled()
|
||||
bool LedDeviceWrapper::enabled() const
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
void LedDeviceWrapper::handleComponentState(const hyperion::Components component, const bool state)
|
||||
void LedDeviceWrapper::handleComponentState(hyperion::Components component, bool state)
|
||||
{
|
||||
if(component == hyperion::COMP_LEDDEVICE)
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -123,7 +123,7 @@ int ProviderHID::close()
|
||||
return retval;
|
||||
}
|
||||
|
||||
int ProviderHID::writeBytes(const unsigned size, const uint8_t * data)
|
||||
int ProviderHID::writeBytes(unsigned size, const uint8_t * data)
|
||||
{
|
||||
if (_blockedForDelay) {
|
||||
return 0;
|
||||
@@ -157,28 +157,30 @@ int ProviderHID::writeBytes(const 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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
@@ -66,7 +66,7 @@ protected:
|
||||
/// @param[in] data The data
|
||||
/// @return Zero on success, else negative
|
||||
///
|
||||
int writeBytes(const unsigned size, const uint8_t *data);
|
||||
int writeBytes(unsigned size, const uint8_t *data);
|
||||
|
||||
// HID VID and PID
|
||||
unsigned short _VendorId;
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -144,7 +144,7 @@ int LedDeviceFadeCandy::close()
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool LedDeviceFadeCandy::isConnected()
|
||||
bool LedDeviceFadeCandy::isConnected() const
|
||||
{
|
||||
bool connected = false;
|
||||
if ( _client != nullptr )
|
||||
@@ -197,7 +197,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() )
|
||||
{
|
||||
|
@@ -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
|
||||
@@ -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
|
||||
|
@@ -335,7 +335,7 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
bool LedDeviceNanoleaf::initRestAPI(const QString &hostname, const int port, const QString &token )
|
||||
bool LedDeviceNanoleaf::initRestAPI(const QString &hostname, int port, const QString &token )
|
||||
{
|
||||
bool isInitOK = false;
|
||||
|
||||
@@ -506,7 +506,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);
|
||||
@@ -607,7 +607,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');
|
||||
|
@@ -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:
|
||||
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
bool initRestAPI(const QString &hostname, const int port, const QString &token );
|
||||
bool initRestAPI(const QString &hostname, int port, const QString &token );
|
||||
|
||||
///
|
||||
/// @brief Get Nanoleaf device details and configuration
|
||||
|
@@ -342,7 +342,7 @@ bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, const int port, const QString &token )
|
||||
bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token)
|
||||
{
|
||||
bool isInitOK = false;
|
||||
|
||||
@@ -398,12 +398,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];
|
||||
@@ -539,17 +539,17 @@ void LedDevicePhilipsHueBridge::setGroupMap(const QJsonDocument &doc)
|
||||
}
|
||||
}
|
||||
|
||||
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getLightMap(void)
|
||||
QMap<quint16,QJsonObject> LedDevicePhilipsHueBridge::getLightMap() const
|
||||
{
|
||||
return _lightsMap;
|
||||
}
|
||||
|
||||
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getGroupMap(void)
|
||||
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 ) )
|
||||
@@ -564,7 +564,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
|
||||
@@ -594,13 +594,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() )
|
||||
@@ -637,13 +637,13 @@ QJsonDocument LedDevicePhilipsHueBridge::post(const QString& route, const QStrin
|
||||
return response.getBody();
|
||||
}
|
||||
|
||||
void LedDevicePhilipsHueBridge::setLightState(const unsigned int lightId, const QString &state)
|
||||
void LedDevicePhilipsHueBridge::setLightState(unsigned int lightId, const QString &state)
|
||||
{
|
||||
DebugIf( verbose, _log, "SetLightState [%u]: %s", lightId, QSTRING_CSTR(state) );
|
||||
post( QString("%1/%2/%3").arg( API_LIGHTS ).arg( lightId ).arg( API_STATE ), state );
|
||||
}
|
||||
|
||||
QJsonDocument LedDevicePhilipsHueBridge::getGroupState(const unsigned int groupId)
|
||||
QJsonDocument LedDevicePhilipsHueBridge::getGroupState(unsigned int groupId)
|
||||
{
|
||||
_restApi->setPath( QString("%1/%2").arg( API_GROUPS ).arg( groupId ) );
|
||||
httpResponse response = _restApi->get();
|
||||
@@ -651,13 +651,13 @@ QJsonDocument LedDevicePhilipsHueBridge::getGroupState(const unsigned int groupI
|
||||
return response.getBody();
|
||||
}
|
||||
|
||||
QJsonDocument LedDevicePhilipsHueBridge::setGroupState(const unsigned int groupId, bool state)
|
||||
QJsonDocument LedDevicePhilipsHueBridge::setGroupState(unsigned int groupId, bool state)
|
||||
{
|
||||
QString active = state ? API_STREAM_ACTIVE_VALUE_TRUE : API_STREAM_ACTIVE_VALUE_FALSE;
|
||||
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 );
|
||||
}
|
||||
@@ -1245,13 +1245,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;
|
||||
|
@@ -197,7 +197,7 @@ public:
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
bool initRestAPI(const QString &hostname, const int port, const QString &token );
|
||||
bool initRestAPI(const QString &hostname, int port, const QString &token );
|
||||
|
||||
///
|
||||
/// @param route the route of the POST request.
|
||||
@@ -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(void) 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;
|
||||
|
@@ -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;
|
||||
|
@@ -39,7 +39,7 @@ bool LedDeviceUdpArtNet::init(const QJsonObject &deviceConfig)
|
||||
}
|
||||
|
||||
// populates the headers
|
||||
void LedDeviceUdpArtNet::prepare(const unsigned this_universe, const unsigned this_sequence, unsigned this_dmxChannelCount)
|
||||
void LedDeviceUdpArtNet::prepare(unsigned this_universe, unsigned this_sequence, unsigned this_dmxChannelCount)
|
||||
{
|
||||
// WTF? why do the specs say:
|
||||
// "This value should be an even number in the range 2 – 512. "
|
||||
|
@@ -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,12 +75,12 @@ 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
|
||||
///
|
||||
void prepare(const unsigned this_universe, const unsigned this_sequence, const unsigned this_dmxChannelCount);
|
||||
void prepare(unsigned this_universe, unsigned this_sequence, unsigned this_dmxChannelCount);
|
||||
|
||||
artnet_packet_t artnet_packet;
|
||||
uint8_t _artnet_seq = 1;
|
||||
|
@@ -71,7 +71,7 @@ bool LedDeviceUdpE131::init(const QJsonObject &deviceConfig)
|
||||
}
|
||||
|
||||
// populates the headers
|
||||
void LedDeviceUdpE131::prepare(const unsigned this_universe, const unsigned this_dmxChannelCount)
|
||||
void LedDeviceUdpE131::prepare(unsigned this_universe, unsigned this_dmxChannelCount)
|
||||
{
|
||||
memset(e131_packet.raw, 0, sizeof(e131_packet.raw));
|
||||
|
||||
|
@@ -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,12 +120,12 @@ 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
|
||||
///
|
||||
void prepare(const unsigned this_universe, const unsigned this_dmxChannelCount);
|
||||
void prepare(unsigned this_universe, unsigned this_dmxChannelCount);
|
||||
|
||||
e131_packet_t e131_packet;
|
||||
uint8_t _e131_seq = 0;
|
||||
|
@@ -35,7 +35,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.
|
||||
@@ -43,7 +43,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;
|
||||
|
||||
QList<int> _ids;
|
||||
QByteArray _message;
|
||||
|
@@ -34,7 +34,7 @@ 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 Writes the RGB-Color values to the LEDs.
|
||||
@@ -42,7 +42,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;
|
||||
};
|
||||
|
||||
#endif // LEDEVICEUDPRAW_H
|
||||
|
@@ -104,7 +104,7 @@ bool LedDeviceWled::init(const QJsonObject &deviceConfig)
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
bool LedDeviceWled::initRestAPI(const QString &hostname, const int port )
|
||||
bool LedDeviceWled::initRestAPI(const QString &hostname, int port)
|
||||
{
|
||||
Debug(_log, "");
|
||||
bool isInitOK = false;
|
||||
@@ -121,7 +121,7 @@ bool LedDeviceWled::initRestAPI(const QString &hostname, const int port )
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
QString LedDeviceWled::getOnOffRequest (bool isOn ) const
|
||||
QString LedDeviceWled::getOnOffRequest(bool isOn) const
|
||||
{
|
||||
QString state = isOn ? STATE_VALUE_TRUE : STATE_VALUE_FALSE;
|
||||
return QString( "{\"%1\":%2}" ).arg( STATE_ON, state);
|
||||
|
@@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the WLED-device
|
||||
///
|
||||
virtual ~LedDeviceWled() override;
|
||||
~LedDeviceWled() override;
|
||||
|
||||
///
|
||||
/// @brief Constructs the WLED-device
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
///
|
||||
/// @return A JSON structure holding a list of devices found
|
||||
///
|
||||
virtual QJsonObject discover() override;
|
||||
QJsonObject discover() override;
|
||||
|
||||
///
|
||||
/// @brief Get the WLED device's resource properties
|
||||
@@ -55,7 +55,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 WLED device to identify it.
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
///
|
||||
/// @param[in] params Parameters to address device
|
||||
///
|
||||
virtual void identify(const QJsonObject& params) override;
|
||||
void identify(const QJsonObject& params) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -79,7 +79,7 @@ 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 Writes the RGB-Color values to the LEDs.
|
||||
@@ -87,21 +87,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 WLED device.
|
||||
///
|
||||
/// @brief Store the device's original state.
|
||||
///
|
||||
virtual bool powerOn() override;
|
||||
bool powerOn() override;
|
||||
|
||||
///
|
||||
/// @brief Power-/turn off the WLED device.
|
||||
///
|
||||
/// @return True if success
|
||||
///
|
||||
virtual bool powerOff() override;
|
||||
bool powerOff() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
/// @param[in] port
|
||||
/// @return True, if success
|
||||
///
|
||||
bool initRestAPI(const QString &hostname, const int port );
|
||||
bool initRestAPI(const QString &hostname, int port );
|
||||
|
||||
///
|
||||
/// @brief Get command to power WLED-device on or off
|
||||
|
@@ -234,12 +234,12 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
|
||||
if ( ! _tcpSocket->waitForBytesWritten(WRITE_TIMEOUT.count()) )
|
||||
{
|
||||
QString errorReason = QString ("(%1) %2").arg(_tcpSocket->error()).arg( _tcpSocket->errorString());
|
||||
log ( 2, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
||||
log ( 2, "Error:", "bytesWritten: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
||||
this->setInError ( errorReason );
|
||||
}
|
||||
else
|
||||
{
|
||||
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
|
||||
log ( 3, "Success:", "Bytes written [%ll]", bytesWritten );
|
||||
|
||||
// Avoid to overrun the Yeelight Command Quota
|
||||
qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _lastWriteTime;
|
||||
@@ -247,7 +247,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
|
||||
if ( elapsedTime < _waitTimeQuota )
|
||||
{
|
||||
int waitTime = _waitTimeQuota;
|
||||
log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %dms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota);
|
||||
log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %llms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota);
|
||||
|
||||
// Wait time (in ms) before doing next write to not overrun Yeelight command quota
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(_waitTimeQuota));
|
||||
@@ -258,7 +258,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
|
||||
{
|
||||
do
|
||||
{
|
||||
log ( 3, "Reading:", "Bytes available [%d]", _tcpSocket->bytesAvailable() );
|
||||
log ( 3, "Reading:", "Bytes available [%ll]", _tcpSocket->bytesAvailable() );
|
||||
while ( _tcpSocket->canReadLine() )
|
||||
{
|
||||
QByteArray response = _tcpSocket->readLine();
|
||||
@@ -338,7 +338,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
|
||||
{
|
||||
int error = _tcpStreamSocket->error();
|
||||
QString errorReason = QString ("(%1) %2").arg(error).arg( _tcpStreamSocket->errorString());
|
||||
log ( 1, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
||||
log ( 1, "Error:", "bytesWritten: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
||||
|
||||
if ( error == QAbstractSocket::RemoteHostClosedError )
|
||||
{
|
||||
@@ -353,7 +353,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
|
||||
}
|
||||
else
|
||||
{
|
||||
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
|
||||
log ( 3, "Success:", "Bytes written [%ll]", bytesWritten );
|
||||
rc = true;
|
||||
}
|
||||
}
|
||||
@@ -572,7 +572,7 @@ bool YeelightLight::identify()
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool YeelightLight::isInMusicMode( bool deviceCheck)
|
||||
bool YeelightLight::isInMusicMode(bool deviceCheck)
|
||||
{
|
||||
bool inMusicMode = false;
|
||||
|
||||
@@ -896,7 +896,7 @@ bool YeelightLight::setColorHSV(const ColorRgb &colorRGB)
|
||||
}
|
||||
|
||||
|
||||
void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int duration )
|
||||
void YeelightLight::setTransitionEffect(YeelightLight::API_EFFECT effect, int duration)
|
||||
{
|
||||
if( effect != _transitionEffect )
|
||||
{
|
||||
@@ -911,7 +911,7 @@ void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int
|
||||
|
||||
}
|
||||
|
||||
void YeelightLight::setBrightnessConfig (int min, int max, bool switchoff, int extraTime, double factor )
|
||||
void YeelightLight::setBrightnessConfig(int min, int max, bool switchoff, int extraTime, double factor)
|
||||
{
|
||||
_brightnessMin = min;
|
||||
_isBrightnessSwitchOffMinimum = switchoff;
|
||||
@@ -944,7 +944,7 @@ bool YeelightLight::setMusicMode(bool on, const QHostAddress &hostAddress, int p
|
||||
return rc;
|
||||
}
|
||||
|
||||
void YeelightLight::log(const int logLevel, const char* msg, const char* type, ...)
|
||||
void YeelightLight::log(int logLevel, const char* msg, const char* type, ...)
|
||||
{
|
||||
if ( logLevel <= _debugLevel)
|
||||
{
|
||||
|
@@ -49,16 +49,14 @@ public:
|
||||
API_NOTIFICATION,
|
||||
};
|
||||
|
||||
explicit YeelightResponse() {}
|
||||
|
||||
API_REPLY error() { return _error;}
|
||||
API_REPLY error() const { return _error;}
|
||||
void setError(const YeelightResponse::API_REPLY replyType) { _error = replyType; }
|
||||
|
||||
QJsonArray getResult() const { return _resultArray; }
|
||||
void setResult(const QJsonArray &result) { _resultArray = result; }
|
||||
|
||||
int getErrorCode() const { return _errorCode; }
|
||||
void setErrorCode(const int &errorCode) { _errorCode = errorCode; _error = API_ERROR;}
|
||||
void setErrorCode(int errorCode) { _errorCode = errorCode; _error = API_ERROR;}
|
||||
|
||||
QString getErrorReason() const { return _errorReason; }
|
||||
void setErrorReason(const QString &errorReason) { _errorReason = errorReason; }
|
||||
@@ -79,7 +77,6 @@ class YeelightLight
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
enum API_EFFECT{
|
||||
API_EFFECT_SMOOTH,
|
||||
API_EFFECT_SUDDEN
|
||||
@@ -281,7 +278,7 @@ public:
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool restoreState();
|
||||
bool restoreState();
|
||||
|
||||
///
|
||||
/// @brief Check, if light was originally powered on before hyperion color streaming started..
|
||||
@@ -353,7 +350,7 @@ private:
|
||||
/// @param[in] type log message text
|
||||
/// @param[in] ... variable input to log message text
|
||||
/// ///
|
||||
void log(const int logLevel,const char* msg, const char* type, ...);
|
||||
void log(int logLevel,const char* msg, const char* type, ...);
|
||||
|
||||
Logger* _log;
|
||||
int _debugLevel;
|
||||
@@ -428,7 +425,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the LedDevice
|
||||
///
|
||||
virtual ~LedDeviceYeelight() override;
|
||||
~LedDeviceYeelight() override;
|
||||
|
||||
///
|
||||
/// @brief Constructs the LED-device
|
||||
@@ -443,7 +440,7 @@ public:
|
||||
///
|
||||
/// @return A JSON structure holding a list of devices found
|
||||
///
|
||||
virtual QJsonObject discover() override;
|
||||
QJsonObject discover() override;
|
||||
|
||||
///
|
||||
/// @brief Get a Yeelight device's resource properties
|
||||
@@ -459,7 +456,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 Yeelight device to identify it.
|
||||
@@ -474,7 +471,7 @@ public:
|
||||
///
|
||||
/// @param[in] params Parameters to address device
|
||||
///
|
||||
virtual void identify(const QJsonObject& params) override;
|
||||
void identify(const QJsonObject& params) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -484,21 +481,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.
|
||||
@@ -506,21 +503,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;
|
||||
|
||||
///
|
||||
/// @brief Store the device's original state.
|
||||
@@ -529,7 +526,7 @@ protected:
|
||||
///
|
||||
/// @return True if success
|
||||
///
|
||||
virtual bool storeState() override;
|
||||
bool storeState() override;
|
||||
|
||||
///
|
||||
/// @brief Restore the device's original state.
|
||||
@@ -539,7 +536,7 @@ protected:
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool restoreState() override;
|
||||
bool restoreState() override;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -16,7 +16,7 @@ const QChar ONE_SLASH = '/';
|
||||
|
||||
} //End of constants
|
||||
|
||||
ProviderRestApi::ProviderRestApi(const QString &host, const int &port, const QString &basePath)
|
||||
ProviderRestApi::ProviderRestApi(const QString &host, int port, const QString &basePath)
|
||||
:_log(Logger::getInstance("LEDDEVICE"))
|
||||
,_networkManager(nullptr)
|
||||
,_scheme("http")
|
||||
@@ -31,7 +31,7 @@ ProviderRestApi::ProviderRestApi(const QString &host, const int &port, const QSt
|
||||
_basePath = basePath;
|
||||
}
|
||||
|
||||
ProviderRestApi::ProviderRestApi(const QString &host, const int &port)
|
||||
ProviderRestApi::ProviderRestApi(const QString &host, int port)
|
||||
: ProviderRestApi(host, port, "") {}
|
||||
|
||||
ProviderRestApi::ProviderRestApi()
|
||||
|
@@ -28,7 +28,7 @@ public:
|
||||
void setErrorReason(const QString &errorReason) { _errorReason = errorReason; }
|
||||
|
||||
int getHttpStatusCode() const { return _httpStatusCode; }
|
||||
void setHttpStatusCode(const int httpStatusCode) { _httpStatusCode = httpStatusCode; }
|
||||
void setHttpStatusCode(int httpStatusCode) { _httpStatusCode = httpStatusCode; }
|
||||
|
||||
QNetworkReply::NetworkError getNetworkReplyError() const { return _networkReplyError; }
|
||||
void setNetworkReplyError (const QNetworkReply::NetworkError networkReplyError) { _networkReplyError = networkReplyError; }
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
/// @param[in] host
|
||||
/// @param[in] port
|
||||
///
|
||||
explicit ProviderRestApi(const QString &host, const int &port);
|
||||
explicit ProviderRestApi(const QString &host, int port);
|
||||
|
||||
///
|
||||
/// @brief Constructor of the REST-API wrapper
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
/// @param[in] port
|
||||
/// @param[in] API base-path
|
||||
///
|
||||
explicit ProviderRestApi(const QString &host, const int &port, const QString &basePath);
|
||||
explicit ProviderRestApi(const QString &host, int port, const QString &basePath);
|
||||
|
||||
///
|
||||
/// @brief Destructor of the REST-API wrapper
|
||||
|
@@ -125,7 +125,7 @@ int ProviderUdp::close()
|
||||
return retval;
|
||||
}
|
||||
|
||||
int ProviderUdp::writeBytes(const unsigned size, const uint8_t * data)
|
||||
int ProviderUdp::writeBytes(unsigned size, const uint8_t * data)
|
||||
{
|
||||
qint64 retVal = _udpSocket->writeDatagram((const char *)data,size,_address,_port);
|
||||
|
||||
|
@@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the UDP LED-device
|
||||
///
|
||||
virtual ~ProviderUdp() override;
|
||||
~ProviderUdp() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -36,21 +36,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 UDP device.
|
||||
///
|
||||
/// @return Zero on success (i.e. device is closed), else negative
|
||||
///
|
||||
virtual int close() override;
|
||||
int close() override;
|
||||
|
||||
///
|
||||
/// @brief Writes the given bytes/bits to the UDP-device and sleeps the latch time to ensure that the
|
||||
@@ -61,7 +61,7 @@ protected:
|
||||
///
|
||||
/// @return Zero on success, else negative
|
||||
///
|
||||
int writeBytes(const unsigned size, const uint8_t *data);
|
||||
int writeBytes(unsigned size, const uint8_t *data);
|
||||
|
||||
///
|
||||
QUdpSocket * _udpSocket;
|
||||
|
@@ -181,7 +181,7 @@ void ProviderUdpSSL::closeSSLConnection()
|
||||
}
|
||||
}
|
||||
|
||||
const int *ProviderUdpSSL::getCiphersuites()
|
||||
const int *ProviderUdpSSL::getCiphersuites() const
|
||||
{
|
||||
return mbedtls_ssl_list_ciphersuites();
|
||||
}
|
||||
@@ -456,7 +456,7 @@ void ProviderUdpSSL::freeSSLConnection()
|
||||
}
|
||||
}
|
||||
|
||||
void ProviderUdpSSL::writeBytes(const unsigned size, const unsigned char * data)
|
||||
void ProviderUdpSSL::writeBytes(unsigned size, const unsigned char * data)
|
||||
{
|
||||
if( _stopConnection ) return;
|
||||
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the LED-device
|
||||
///
|
||||
virtual ~ProviderUdpSSL() override;
|
||||
~ProviderUdpSSL() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -76,21 +76,21 @@ protected:
|
||||
/// @param[in] deviceConfig the JSON device configuration
|
||||
/// @return True, if success#endif // PROVIDERUDP_H
|
||||
///
|
||||
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 Initialise device's network details
|
||||
@@ -106,14 +106,14 @@ protected:
|
||||
/// @param[in] size The length of the data
|
||||
/// @param[in] data The data
|
||||
///
|
||||
void writeBytes(const unsigned size, const uint8_t *data);
|
||||
void writeBytes(unsigned size, const uint8_t *data);
|
||||
|
||||
///
|
||||
/// get ciphersuites list from mbedtls_ssl_list_ciphersuites
|
||||
///
|
||||
/// @return const int * array
|
||||
///
|
||||
virtual const int * getCiphersuites();
|
||||
virtual const int * getCiphersuites() const;
|
||||
|
||||
void sslLog(const QString &msg, const char* errorType = "debug");
|
||||
void sslLog(const char* msg, const char* errorType = "debug");
|
||||
|
@@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the LedDevice
|
||||
///
|
||||
virtual ~LedDeviceFile() override;
|
||||
~LedDeviceFile() override;
|
||||
|
||||
///
|
||||
/// @brief Constructs the LED-device
|
||||
@@ -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 Writes the RGB-Color values to the LEDs.
|
||||
@@ -65,7 +65,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;
|
||||
|
||||
/// The outputstream
|
||||
QFile* _file;
|
||||
|
@@ -20,7 +20,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the LedDevice
|
||||
///
|
||||
virtual ~LedDevicePiBlaster() override;
|
||||
~LedDevicePiBlaster() override;
|
||||
|
||||
///
|
||||
/// @brief Constructs the LED-device
|
||||
@@ -43,14 +43,14 @@ protected:
|
||||
///
|
||||
/// @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;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -127,7 +127,7 @@ int LedDeviceWS281x::write(const std::vector<ColorRgb> &ledValues)
|
||||
Rgb_to_Rgbw(color, &_temp_rgbw, _whiteAlgorithm);
|
||||
}
|
||||
|
||||
_led_string.channel[_channel].leds[idx++] =
|
||||
_led_string.channel[_channel].leds[idx++] =
|
||||
((uint32_t)_temp_rgbw.white << 24) + ((uint32_t)_temp_rgbw.red << 16) + ((uint32_t)_temp_rgbw.green << 8) + _temp_rgbw.blue;
|
||||
|
||||
}
|
||||
@@ -135,6 +135,6 @@ int LedDeviceWS281x::write(const std::vector<ColorRgb> &ledValues)
|
||||
{
|
||||
_led_string.channel[_channel].leds[idx++] = 0;
|
||||
}
|
||||
|
||||
|
||||
return ws2811_render(&_led_string) ? -1 : 0;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the LedDevice
|
||||
///
|
||||
virtual ~LedDeviceWS281x() override;
|
||||
~LedDeviceWS281x() override;
|
||||
|
||||
///
|
||||
/// @brief Destructor of the LedDevice
|
||||
@@ -37,21 +37,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.
|
||||
@@ -59,7 +59,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:
|
||||
|
||||
|
@@ -35,7 +35,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.
|
||||
@@ -43,7 +43,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;
|
||||
|
||||
const short _headerSize;
|
||||
bool _ligthBerryAPA102Mode;
|
||||
|
@@ -30,7 +30,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.
|
||||
@@ -38,7 +38,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 // LEDEVICEATMO_H
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
||||
/// @return LedDevice constructed
|
||||
static LedDevice* construct(const QJsonObject &deviceConfig);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
@@ -33,7 +33,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.
|
||||
@@ -41,7 +41,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 _dmxDeviceType = 0;
|
||||
int _dmxStart = 1;
|
||||
|
@@ -34,14 +34,14 @@ 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.
|
||||
///
|
||||
/// @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 // LEDEVICEKARATE_H
|
||||
|
@@ -33,7 +33,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.
|
||||
@@ -41,7 +41,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 // LEDEVICESEDU_H
|
||||
|
@@ -33,7 +33,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.
|
||||
@@ -41,7 +41,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 // LEDEVICETPM2_H
|
||||
|
@@ -110,7 +110,7 @@ bool ProviderRs232::powerOff()
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool ProviderRs232::tryOpen(const int delayAfterConnect_ms)
|
||||
bool ProviderRs232::tryOpen(int delayAfterConnect_ms)
|
||||
{
|
||||
if (_deviceName.isEmpty() || _rs232Port.portName().isEmpty())
|
||||
{
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
///
|
||||
/// @brief Destructor of the UDP LED-device
|
||||
///
|
||||
virtual ~ProviderRs232() override;
|
||||
~ProviderRs232() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -34,21 +34,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 UDP device.
|
||||
///
|
||||
/// @return Zero on success (i.e. device is closed), else negative
|
||||
///
|
||||
virtual int close() override;
|
||||
int close() override;
|
||||
|
||||
///
|
||||
/// @brief Power-/turn off a RS232-device
|
||||
@@ -57,21 +57,21 @@ protected:
|
||||
///
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool powerOff() override;
|
||||
bool powerOff() override;
|
||||
|
||||
///
|
||||
/// @brief Discover first devices of a serial device available (for configuration)
|
||||
///
|
||||
/// @return A string of the device found
|
||||
///
|
||||
virtual QString discoverFirst() override;
|
||||
QString discoverFirst() override;
|
||||
|
||||
///
|
||||
/// @brief Discover RS232 serial devices available (for configuration).
|
||||
///
|
||||
/// @return A JSON structure holding a list of devices found
|
||||
///
|
||||
virtual QJsonObject discover() override;
|
||||
QJsonObject discover() override;
|
||||
|
||||
///
|
||||
/// @brief Write the given bytes to the RS232-device
|
||||
@@ -96,7 +96,7 @@ protected slots:
|
||||
///
|
||||
/// @param errorMsg The error message to be logged
|
||||
///
|
||||
virtual void setInError( const QString& errorMsg) override;
|
||||
void setInError( const QString& errorMsg) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
///
|
||||
/// @return True,if on success
|
||||
///
|
||||
bool tryOpen(const int delayAfterConnect_ms);
|
||||
bool tryOpen(int delayAfterConnect_ms);
|
||||
|
||||
/// Try to auto-discover device name?
|
||||
bool _isAutoDeviceName;
|
||||
|
@@ -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 // LEDEVICEAPA102_H
|
||||
|
@@ -33,7 +33,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.
|
||||
@@ -41,7 +41,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;
|
||||
|
||||
const int SPI_BYTES_PER_COLOUR;
|
||||
const int SPI_FRAME_END_LATCH_BYTES;
|
||||
|
@@ -41,7 +41,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.
|
||||
@@ -49,7 +49,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 // LEDEVICELPD6803_H
|
||||
|
@@ -103,7 +103,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.
|
||||
@@ -111,7 +111,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 // LEDEVICELPD8806_H
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user