Commit 8f978a25 by “liusq”

修改请求远程配置超时问题

parent 8bd021ba
...@@ -161,7 +161,7 @@ vides_data::response *HttpService::httpFindCameras(QString &serialNumber,vides_d ...@@ -161,7 +161,7 @@ vides_data::response *HttpService::httpFindCameras(QString &serialNumber,vides_d
}else{ }else{
qInfo()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=m_httpClient.errorCode();
} }
return resp; return resp;
} }
......
...@@ -7,7 +7,7 @@ HttpClient::HttpClient(QObject *parent) ...@@ -7,7 +7,7 @@ HttpClient::HttpClient(QObject *parent)
{ {
m_networkAccessManager = new QNetworkAccessManager(this); m_networkAccessManager = new QNetworkAccessManager(this);
m_timer = new QTimer(this); m_timer = new QTimer(this);
m_timer->setInterval(6000); m_timer->setInterval(8000);
m_timer->setSingleShot(true); m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit())); connect(m_timer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit()));
} }
......
...@@ -500,10 +500,10 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -500,10 +500,10 @@ void MainWindow::startCamera(const QString &httpurl){
} }
vides_data::responseConfig cloudConfig; vides_data::responseConfig cloudConfig;
httpService.setHttpUrl(httpurl); HttpService http_config(httpurl);
vides_data::response *res_config= httpService.httpDeviceConfig(serialNumber,cloudConfig); vides_data::response *res_config= http_config.httpDeviceConfig(serialNumber,cloudConfig);
if(res_config->code!=0){ if(res_config->code!=0){
qInfo()<<"请求远程商户配置失败"; qInfo()<<"请求远程商户配置失败"<<res_config->msg<<res_config->code;
instace.deleteObj(res_config); instace.deleteObj(res_config);
return ; return ;
} }
...@@ -516,12 +516,10 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -516,12 +516,10 @@ void MainWindow::startCamera(const QString &httpurl){
QString ipAddress= QString("%1.%2.%3.%4").arg(localDevice->HostIP.c[0]).arg(localDevice->HostIP.c[1]).arg(localDevice->HostIP.c[2]).arg(localDevice->HostIP.c[3]); QString ipAddress= QString("%1.%2.%3.%4").arg(localDevice->HostIP.c[0]).arg(localDevice->HostIP.c[1]).arg(localDevice->HostIP.c[2]).arg(localDevice->HostIP.c[3]);
//this->gatewayRandomIp(ipAddress); //this->gatewayRandomIp(ipAddress);
QString key = ipAddress + ":" + QString::number(localDevice->TCPPort); QString key = ipAddress + ":" + QString::number(localDevice->TCPPort);
HttpService http_device(httpurl);
httpService.setHttpUrl(httpurl);
vides_data::responseConfig devConfig; vides_data::responseConfig devConfig;
vides_data::response *devRes=httpService.httpDeviceConfig(device.sSn,devConfig); vides_data::response *devRes=http_device.httpDeviceConfig(device.sSn,devConfig);
if(devRes->code!=0){ if(devRes->code!=0){
qInfo()<<"请求相机配置失败"; qInfo()<<"请求相机配置失败";
instace.deleteObj(devRes); instace.deleteObj(devRes);
...@@ -581,9 +579,8 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -581,9 +579,8 @@ void MainWindow::startCamera(const QString &httpurl){
// 清空 localDevices 容器 // 清空 localDevices 容器
localDevices.clear(); localDevices.clear();
} }
HttpService http_div(httpurl);
httpService.setHttpUrl(httpurl); vides_data::response *res=http_div.httpPostDeviceStatus(reStatus);
vides_data::response *res=httpService.httpPostDeviceStatus(reStatus);
if(res->code!=0){ if(res->code!=0){
qInfo()<<"盒子状态上报失败 code:"<<res->code<<"msg:"<<res->msg; qInfo()<<"盒子状态上报失败 code:"<<res->code<<"msg:"<<res->msg;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment