parent
bae722abc3
commit
67bfd952fa
@ -1324,12 +1324,17 @@ DeviceManager::DeviceError DeviceManager::verifyParam(const ParamType ¶mType
|
|||||||
return DeviceErrorInvalidParameter;
|
return DeviceErrorInvalidParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramType.maxValue().isValid() && param.value().convert(paramType.type()) > paramType.maxValue().convert(paramType.type())) {
|
if (!param.value().convert(paramType.type())) {
|
||||||
|
qCWarning(dcDeviceManager) << "Could not convert value of param" << param.name() << " to:" << QVariant::typeToName(paramType.type()) << " Got:" << param.value();
|
||||||
|
return DeviceErrorInvalidParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paramType.maxValue().isValid() && param.value() > paramType.maxValue()) {
|
||||||
qCWarning(dcDeviceManager) << "Value out of range for param" << param.name() << " Got:" << param.value() << " Max:" << paramType.maxValue();
|
qCWarning(dcDeviceManager) << "Value out of range for param" << param.name() << " Got:" << param.value() << " Max:" << paramType.maxValue();
|
||||||
return DeviceErrorInvalidParameter;
|
return DeviceErrorInvalidParameter;
|
||||||
}
|
}
|
||||||
if (paramType.minValue().isValid() && param.value().convert(paramType.type()) < paramType.minValue().convert(paramType.type())) {
|
if (paramType.minValue().isValid() && param.value() < paramType.minValue()) {
|
||||||
qCWarning(dcDeviceManager) << "Value out of range for param" << param.name() << " Got:" << param.value() << " Min:" << paramType.minValue().convert(paramType.type());
|
qCWarning(dcDeviceManager) << "Value out of range for param" << param.name() << " Got:" << param.value() << " Min:" << paramType.minValue();
|
||||||
return DeviceErrorInvalidParameter;
|
return DeviceErrorInvalidParameter;
|
||||||
}
|
}
|
||||||
if (!paramType.allowedValues().isEmpty() && !paramType.allowedValues().contains(param.value())) {
|
if (!paramType.allowedValues().isEmpty() && !paramType.allowedValues().contains(param.value())) {
|
||||||
|
|||||||
@ -190,6 +190,11 @@ DeviceManager::DeviceError DevicePluginMock::executeAction(Device *device, const
|
|||||||
} else if (action.actionTypeId() == percentageActionTypeId) {
|
} else if (action.actionTypeId() == percentageActionTypeId) {
|
||||||
device->setStateValue(percentageStateTypeId, action.param("percentage").value().toInt());
|
device->setStateValue(percentageStateTypeId, action.param("percentage").value().toInt());
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
} else if (action.actionTypeId() == allowedValuesActionTypeId) {
|
||||||
|
device->setStateValue(allowedValuesStateTypeId, action.param("allowed values").value().toString());
|
||||||
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
} else if (action.actionTypeId() == timeoutActionTypeId) {
|
||||||
|
return DeviceManager::DeviceErrorAsync;
|
||||||
}
|
}
|
||||||
return DeviceManager::DeviceErrorActionTypeNotFound;
|
return DeviceManager::DeviceErrorActionTypeNotFound;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -247,6 +247,28 @@
|
|||||||
"minValue": 0,
|
"minValue": 0,
|
||||||
"maxValue": 100
|
"maxValue": 100
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "05f63f9c-f61e-4dcf-ad55-3f13fde2765b",
|
||||||
|
"idName": "allowedValues",
|
||||||
|
"name": "allowed values",
|
||||||
|
"type": "QString",
|
||||||
|
"defaultValue": "String value 1",
|
||||||
|
"writable": {
|
||||||
|
"allowedValues": [
|
||||||
|
"String value 1",
|
||||||
|
"String value 2",
|
||||||
|
"String value 3",
|
||||||
|
"String value 4"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actionTypes": [
|
||||||
|
{
|
||||||
|
"id": "54646e7c-bc54-4895-81a2-590d72d120f9",
|
||||||
|
"idName": "timeout",
|
||||||
|
"name": "Timout action"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,7 +140,7 @@ HttpReply::HttpReply(QObject *parent) :
|
|||||||
setHeader(HttpHeaderType::CacheControlHeader, "no-cache");
|
setHeader(HttpHeaderType::CacheControlHeader, "no-cache");
|
||||||
setHeader(HttpHeaderType::ConnectionHeader, "Keep-Alive");
|
setHeader(HttpHeaderType::ConnectionHeader, "Keep-Alive");
|
||||||
setRawHeader("Access-Control-Allow-Origin","*");
|
setRawHeader("Access-Control-Allow-Origin","*");
|
||||||
setRawHeader("Keep-Alive", "timeout=10, max=50");
|
setRawHeader("Keep-Alive", "timeout=12, max=50");
|
||||||
packReply();
|
packReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ HttpReply::HttpReply(const HttpReply::HttpStatusCode &statusCode, const HttpRepl
|
|||||||
setHeader(HttpHeaderType::CacheControlHeader, "no-cache");
|
setHeader(HttpHeaderType::CacheControlHeader, "no-cache");
|
||||||
setHeader(HttpHeaderType::ConnectionHeader, "Keep-Alive");
|
setHeader(HttpHeaderType::ConnectionHeader, "Keep-Alive");
|
||||||
setRawHeader("Access-Control-Allow-Origin","*");
|
setRawHeader("Access-Control-Allow-Origin","*");
|
||||||
setRawHeader("Keep-Alive", "timeout=10, max=50");
|
setRawHeader("Keep-Alive", "timeout=12, max=50");
|
||||||
packReply();
|
packReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -701,7 +701,7 @@ void WebServerClient::addConnection(QSslSocket *socket)
|
|||||||
{
|
{
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
timer->setSingleShot(true);
|
timer->setSingleShot(true);
|
||||||
timer->setInterval(9500);
|
timer->setInterval(12000);
|
||||||
connect(timer, &QTimer::timeout, this, &WebServerClient::onTimout);
|
connect(timer, &QTimer::timeout, this, &WebServerClient::onTimout);
|
||||||
|
|
||||||
m_runningConnections.insert(timer, socket);
|
m_runningConnections.insert(timer, socket);
|
||||||
|
|||||||
Reference in New Issue
Block a user