diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index da748d0a..6e23a918 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -448,7 +448,9 @@ void DeviceManager::createNewAutoDevices() } } while (success); } - storeConfiguredDevices(); + if (haveNewDevice) { + storeConfiguredDevices(); + } } void DeviceManager::slotDevicesDiscovered(const DeviceClassId &deviceClassId, const QList deviceDescriptors) diff --git a/libguh/plugin/deviceplugin.h b/libguh/plugin/deviceplugin.h index 5a0d9aad..8d97590c 100644 --- a/libguh/plugin/deviceplugin.h +++ b/libguh/plugin/deviceplugin.h @@ -62,8 +62,10 @@ public: virtual void setConfiguration(const QVariantMap &configuration); public slots: - virtual DeviceManager::DeviceError executeAction(Device *device, const Action &action) {Q_UNUSED(device) Q_UNUSED(action)} - + virtual DeviceManager::DeviceError executeAction(Device *device, const Action &action) { + Q_UNUSED(device) Q_UNUSED(action) + return DeviceManager::DeviceErrorNoError; + } signals: void emitEvent(const Event &event); diff --git a/plugins/deviceplugins/boblight/bobclient.cpp b/plugins/deviceplugins/boblight/bobclient.cpp index 019b6e6f..f919464a 100644 --- a/plugins/deviceplugins/boblight/bobclient.cpp +++ b/plugins/deviceplugins/boblight/bobclient.cpp @@ -78,7 +78,10 @@ void BobClient::sync() for(int i = 0; i < lightsCount(); ++i) { //load the color into int array - int rgb[3] = {m_colors[i].red() * m_colors[i].alphaF(), m_colors[i].green() * m_colors[i].alphaF(), m_colors[i].blue() * m_colors[i].alphaF()}; + int rgb[3]; + rgb[0] = m_colors[i].red() * m_colors[i].alphaF(); + rgb[1] = m_colors[i].green() * m_colors[i].alphaF(); + rgb[2] = m_colors[i].blue() * m_colors[i].alphaF(); // qDebug() << "set color" << rgb[0] << rgb[1] << rgb[2]; //set all lights to the color we want and send it diff --git a/plugins/deviceplugins/mock/devicepluginmock.cpp b/plugins/deviceplugins/mock/devicepluginmock.cpp index 670d3c73..0401833e 100644 --- a/plugins/deviceplugins/mock/devicepluginmock.cpp +++ b/plugins/deviceplugins/mock/devicepluginmock.cpp @@ -179,6 +179,7 @@ DeviceManager::DeviceError DevicePluginMock::executeAction(Device *device, const { qDebug() << "Should execute action" << action.actionTypeId(); m_daemons.value(device)->actionExecuted(action.actionTypeId()); + return DeviceManager::DeviceErrorNoError; } void DevicePluginMock::setState(const StateTypeId &stateTypeId, const QVariant &value) diff --git a/server/jsonrpc/devicehandler.cpp b/server/jsonrpc/devicehandler.cpp index 741c5aac..29b397ef 100644 --- a/server/jsonrpc/devicehandler.cpp +++ b/server/jsonrpc/devicehandler.cpp @@ -164,6 +164,7 @@ QString DeviceHandler::name() const JsonReply* DeviceHandler::GetSupportedVendors(const QVariantMap ¶ms) const { + Q_UNUSED(params) QVariantMap returns; QVariantList supportedVendors; foreach (const Vendor &vendor, GuhCore::instance()->deviceManager()->supportedVendors()) { @@ -313,14 +314,13 @@ JsonReply* DeviceHandler::RemoveConfiguredDevice(const QVariantMap ¶ms) case DeviceManager::DeviceErrorNoError: returns.insert("success", true); returns.insert("errorMessage", ""); - return createReply(returns); case DeviceManager::DeviceErrorDeviceNotFound: returns.insert("success", false); returns.insert("errorMessage", "No such device."); - return createReply(returns); + default: + returns.insert("success", false); + returns.insert("errorMessage", "Unknown error."); } - returns.insert("success", false); - returns.insert("errorMessage", "Unknown error."); return createReply(returns); } diff --git a/server/jsonrpc/jsonhandler.cpp b/server/jsonrpc/jsonhandler.cpp index 4b4ebd88..299fe328 100644 --- a/server/jsonrpc/jsonhandler.cpp +++ b/server/jsonrpc/jsonhandler.cpp @@ -61,6 +61,8 @@ QVariantMap JsonHandler::introspect(QMetaMethod::MethodType type) data.insert(name() + "." + method.name(), methodData); } break; + default: + ;;// Nothing to do for slots } } } @@ -132,10 +134,10 @@ JsonReply* JsonHandler::createAsyncReply(const QString &method) const JsonReply::JsonReply(Type type, JsonHandler *handler, const QString &method, const QVariantMap &data): - m_handler(handler), - m_method(method), m_type(type), - m_data(data) + m_data(data), + m_handler(handler), + m_method(method) { connect(&m_timeout, &QTimer::timeout, this, &JsonReply::timeout); } diff --git a/server/jsonrpc/jsonrpcserver.cpp b/server/jsonrpc/jsonrpcserver.cpp index 56ef342c..bf703ca1 100644 --- a/server/jsonrpc/jsonrpcserver.cpp +++ b/server/jsonrpc/jsonrpcserver.cpp @@ -221,11 +221,6 @@ void JsonRPCServer::sendNotification(const QVariantMap ¶ms) m_tcpServer->sendData(m_clients.keys(true), jsonDoc.toJson()); } -void JsonRPCServer::sendAsyncReply(int id, const QVariantMap ¶ms) -{ - qDebug() << "should send async reply"; -} - void JsonRPCServer::asyncReplyFinished() { JsonReply *reply = qobject_cast(sender()); @@ -238,7 +233,6 @@ void JsonRPCServer::asyncReplyFinished() void JsonRPCServer::registerHandler(JsonHandler *handler) { m_handlers.insert(handler->name(), handler); - connect(handler, &JsonHandler::asyncReply, this, &JsonRPCServer::sendAsyncReply); for (int i = 0; i < handler->metaObject()->methodCount(); ++i) { QMetaMethod method = handler->metaObject()->method(i); if (method.methodType() == QMetaMethod::Signal && QString(method.name()).contains(QRegExp("^[A-Z]"))) { diff --git a/server/jsonrpc/jsonrpcserver.h b/server/jsonrpc/jsonrpcserver.h index 0643f052..d04be0fb 100644 --- a/server/jsonrpc/jsonrpcserver.h +++ b/server/jsonrpc/jsonrpcserver.h @@ -60,7 +60,6 @@ private slots: void processData(const QUuid &clientId, const QByteArray &jsonData); void sendNotification(const QVariantMap ¶ms); - void sendAsyncReply(int id, const QVariantMap ¶ms); void asyncReplyFinished(); diff --git a/server/jsonrpc/jsontypes.cpp b/server/jsonrpc/jsontypes.cpp index 67ac02f6..b9373f85 100644 --- a/server/jsonrpc/jsontypes.cpp +++ b/server/jsonrpc/jsontypes.cpp @@ -246,7 +246,9 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass) QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin) { - + Q_UNUSED(plugin) + qWarning() << "packPlugin not implemented yet!"; + return QVariantMap(); } QVariantMap JsonTypes::packDevice(Device *device)