|
@@ -17,7 +17,7 @@ HttpThread::HttpThread(QObject *parent) : QObject(parent)
|
|
|
|
|
|
timer = new QTimer(this);
|
|
|
connect(timer,&QTimer::timeout,this,&HttpThread::time_out);
|
|
|
- timer->start(5000);
|
|
|
+ timer->start(1000);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -42,8 +42,7 @@ void HttpThread::finishedSlot(QNetworkReply *reply)
|
|
|
double wd=0.00,sd=0.00,pm2_5=0.00,co2=0.00;
|
|
|
int voc= 0;
|
|
|
int fan_status = 0;
|
|
|
-// int ts = (QDateTime::fromString(QDateTime::currentDateTime().toString("yyyy-MM-dd HH")+":00:00","yyyy-MM-dd HH:mm:ss")).toTime_t();
|
|
|
- int ts = QDateTime::currentDateTime().toTime_t();
|
|
|
+ int ts = (QDateTime::fromString(QDateTime::currentDateTime().toString("yyyy-MM-dd HH")+":00:00","yyyy-MM-dd HH:mm:ss")).toTime_t();
|
|
|
for(int i=0;i<list_array.size();i++){
|
|
|
QJsonObject list_object = list_array.at(i).toObject();
|
|
|
device_code = list_object.value("roomNo").toString();
|
|
@@ -179,35 +178,13 @@ void HttpThread::time_out()
|
|
|
{
|
|
|
agBoxShm->processStatus[11].t_time=QDateTime::currentDateTime().toTime_t();
|
|
|
|
|
|
-// if(hour != QDateTime::currentDateTime().time().hour()){
|
|
|
-// hour = QDateTime::currentDateTime().time().hour();
|
|
|
-// for(int i=0;i<1024;i++){
|
|
|
-// if(QString("http").compare(QString(agBoxShm->device[i].device_gateway))==0){
|
|
|
-// roomList.append(QString(agBoxShm->device[i].device_code));
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// //每小时获取一次阿里天气数据
|
|
|
-// if(!isWaiting1){
|
|
|
-// isWaiting1 = true;
|
|
|
-// QNetworkRequest *req = new QNetworkRequest();
|
|
|
-// QString url = QString("https://weather01.market.alicloudapi.com/area-to-weather?area=历城区");
|
|
|
-// req->setUrl(QUrl(url));
|
|
|
-// req->setHeader(QNetworkRequest::ContentTypeHeader,"application/json");
|
|
|
-// req->setRawHeader("Accept","*/*");
|
|
|
-// req->setRawHeader("Connection","keep-alive");
|
|
|
-// req->setRawHeader("Cache-Control"," no-cache");
|
|
|
-// req->setRawHeader("Authorization","APPCODE 0f2b7fce6e104ba8835358b7b59b4fb6");
|
|
|
-// QNetworkReply *reply = networkManager1->get(*req);
|
|
|
-// QReplayTimeout *pTimeout = new QReplayTimeout(reply,10000);
|
|
|
-// connect(pTimeout, SIGNAL(net_timeout()),this,SLOT(reply_timeout1()));
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
if(hour != QDateTime::currentDateTime().time().hour()){
|
|
|
hour = QDateTime::currentDateTime().time().hour();
|
|
|
+ for(int i=0;i<1024;i++){
|
|
|
+ if(QString("http").compare(QString(agBoxShm->device[i].device_gateway))==0){
|
|
|
+ roomList.append(QString(agBoxShm->device[i].device_code));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//每小时获取一次阿里天气数据
|
|
|
if(!isWaiting1){
|
|
@@ -228,13 +205,6 @@ void HttpThread::time_out()
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(QDateTime::currentDateTime().time().minute()%10 == 0){
|
|
|
- for(int i=0;i<1024;i++){
|
|
|
- if(QString("http").compare(QString(agBoxShm->device[i].device_gateway))==0){
|
|
|
- roomList.append(QString(agBoxShm->device[i].device_code));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
if(!isWaiting && roomList.length() > 0){ //每小时获取3-12层每个房间设备列表心跳数据一次
|
|
|
isWaiting = true;
|