Fix empty error messages when updating sensor config and state
@@ -685,11 +685,8 @@ int DeRestPluginPrivate::changeSensorConfig(const ApiRequest &req, ApiResponse &
if (getResourceItemDescriptor(QString("config/%1").arg(pi.key()), rid))
{
item = sensor->item(rid.suffix);
- if (!item)
+ if (item)
{
- break; // not found
- }
-
QVariant val = map[pi.key()];
if (item->setValue(val))
{
@@ -707,6 +704,7 @@ int DeRestPluginPrivate::changeSensorConfig(const ApiRequest &req, ApiResponse &
return REQ_READY_SEND;
}
}
+ }
if (!item)
{
@@ -784,11 +782,8 @@ int DeRestPluginPrivate::changeSensorState(const ApiRequest &req, ApiResponse &r
if (isClip && getResourceItemDescriptor(QString("state/%1").arg(pi.key()), rid))
{
item = sensor->item(rid.suffix);
- if (!item)
+ if (item)
{
- break; // not found
- }
-
QVariant val = map[pi.key()];
if (item->setValue(val))
{
@@ -797,6 +792,7 @@ int DeRestPluginPrivate::changeSensorState(const ApiRequest &req, ApiResponse &r
Event e(RSensors, rid.suffix, id);
enqueueEvent(e);
+ sensor->updateStateTimestamp();
}
else // invalid
{
@@ -806,6 +802,7 @@ int DeRestPluginPrivate::changeSensorState(const ApiRequest &req, ApiResponse &r
return REQ_READY_SEND;
}
}
+ }
if (!item)
{
