fix some warnings

This commit is contained in:
Michael Zanetti 2014-04-16 01:13:16 +02:00
parent 364cef6a8f
commit fe95326a10
9 changed files with 24 additions and 19 deletions

View File

@ -448,7 +448,9 @@ void DeviceManager::createNewAutoDevices()
} }
} while (success); } while (success);
} }
storeConfiguredDevices(); if (haveNewDevice) {
storeConfiguredDevices();
}
} }
void DeviceManager::slotDevicesDiscovered(const DeviceClassId &deviceClassId, const QList<DeviceDescriptor> deviceDescriptors) void DeviceManager::slotDevicesDiscovered(const DeviceClassId &deviceClassId, const QList<DeviceDescriptor> deviceDescriptors)

View File

@ -62,8 +62,10 @@ public:
virtual void setConfiguration(const QVariantMap &configuration); virtual void setConfiguration(const QVariantMap &configuration);
public slots: 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: signals:
void emitEvent(const Event &event); void emitEvent(const Event &event);

View File

@ -78,7 +78,10 @@ void BobClient::sync()
for(int i = 0; i < lightsCount(); ++i) { for(int i = 0; i < lightsCount(); ++i) {
//load the color into int array //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]; // qDebug() << "set color" << rgb[0] << rgb[1] << rgb[2];
//set all lights to the color we want and send it //set all lights to the color we want and send it

View File

@ -179,6 +179,7 @@ DeviceManager::DeviceError DevicePluginMock::executeAction(Device *device, const
{ {
qDebug() << "Should execute action" << action.actionTypeId(); qDebug() << "Should execute action" << action.actionTypeId();
m_daemons.value(device)->actionExecuted(action.actionTypeId()); m_daemons.value(device)->actionExecuted(action.actionTypeId());
return DeviceManager::DeviceErrorNoError;
} }
void DevicePluginMock::setState(const StateTypeId &stateTypeId, const QVariant &value) void DevicePluginMock::setState(const StateTypeId &stateTypeId, const QVariant &value)

View File

@ -164,6 +164,7 @@ QString DeviceHandler::name() const
JsonReply* DeviceHandler::GetSupportedVendors(const QVariantMap &params) const JsonReply* DeviceHandler::GetSupportedVendors(const QVariantMap &params) const
{ {
Q_UNUSED(params)
QVariantMap returns; QVariantMap returns;
QVariantList supportedVendors; QVariantList supportedVendors;
foreach (const Vendor &vendor, GuhCore::instance()->deviceManager()->supportedVendors()) { foreach (const Vendor &vendor, GuhCore::instance()->deviceManager()->supportedVendors()) {
@ -313,14 +314,13 @@ JsonReply* DeviceHandler::RemoveConfiguredDevice(const QVariantMap &params)
case DeviceManager::DeviceErrorNoError: case DeviceManager::DeviceErrorNoError:
returns.insert("success", true); returns.insert("success", true);
returns.insert("errorMessage", ""); returns.insert("errorMessage", "");
return createReply(returns);
case DeviceManager::DeviceErrorDeviceNotFound: case DeviceManager::DeviceErrorDeviceNotFound:
returns.insert("success", false); returns.insert("success", false);
returns.insert("errorMessage", "No such device."); 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); return createReply(returns);
} }

View File

@ -61,6 +61,8 @@ QVariantMap JsonHandler::introspect(QMetaMethod::MethodType type)
data.insert(name() + "." + method.name(), methodData); data.insert(name() + "." + method.name(), methodData);
} }
break; 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): JsonReply::JsonReply(Type type, JsonHandler *handler, const QString &method, const QVariantMap &data):
m_handler(handler),
m_method(method),
m_type(type), m_type(type),
m_data(data) m_data(data),
m_handler(handler),
m_method(method)
{ {
connect(&m_timeout, &QTimer::timeout, this, &JsonReply::timeout); connect(&m_timeout, &QTimer::timeout, this, &JsonReply::timeout);
} }

View File

@ -221,11 +221,6 @@ void JsonRPCServer::sendNotification(const QVariantMap &params)
m_tcpServer->sendData(m_clients.keys(true), jsonDoc.toJson()); m_tcpServer->sendData(m_clients.keys(true), jsonDoc.toJson());
} }
void JsonRPCServer::sendAsyncReply(int id, const QVariantMap &params)
{
qDebug() << "should send async reply";
}
void JsonRPCServer::asyncReplyFinished() void JsonRPCServer::asyncReplyFinished()
{ {
JsonReply *reply = qobject_cast<JsonReply*>(sender()); JsonReply *reply = qobject_cast<JsonReply*>(sender());
@ -238,7 +233,6 @@ void JsonRPCServer::asyncReplyFinished()
void JsonRPCServer::registerHandler(JsonHandler *handler) void JsonRPCServer::registerHandler(JsonHandler *handler)
{ {
m_handlers.insert(handler->name(), handler); m_handlers.insert(handler->name(), handler);
connect(handler, &JsonHandler::asyncReply, this, &JsonRPCServer::sendAsyncReply);
for (int i = 0; i < handler->metaObject()->methodCount(); ++i) { for (int i = 0; i < handler->metaObject()->methodCount(); ++i) {
QMetaMethod method = handler->metaObject()->method(i); QMetaMethod method = handler->metaObject()->method(i);
if (method.methodType() == QMetaMethod::Signal && QString(method.name()).contains(QRegExp("^[A-Z]"))) { if (method.methodType() == QMetaMethod::Signal && QString(method.name()).contains(QRegExp("^[A-Z]"))) {

View File

@ -60,7 +60,6 @@ private slots:
void processData(const QUuid &clientId, const QByteArray &jsonData); void processData(const QUuid &clientId, const QByteArray &jsonData);
void sendNotification(const QVariantMap &params); void sendNotification(const QVariantMap &params);
void sendAsyncReply(int id, const QVariantMap &params);
void asyncReplyFinished(); void asyncReplyFinished();

View File

@ -246,7 +246,9 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass)
QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin) QVariantMap JsonTypes::packPlugin(DevicePlugin *plugin)
{ {
Q_UNUSED(plugin)
qWarning() << "packPlugin not implemented yet!";
return QVariantMap();
} }
QVariantMap JsonTypes::packDevice(Device *device) QVariantMap JsonTypes::packDevice(Device *device)