|
|
@@ -73,21 +73,6 @@ static char* g_product_pwr_type_str[] = {
|
|
|
};
|
|
|
static int webSetCallback(void);
|
|
|
|
|
|
-
|
|
|
-#ifndef USE_WEBAPP
|
|
|
-const char *hdr_str=
|
|
|
-"Vary: Accept-Encoding\r\n"
|
|
|
-"Keep-Alive: timeout=30 max=394\r\n"
|
|
|
-"Content-Type: text/html\r\n"
|
|
|
-"X-Frame-Options: SAMEORIGIN\r\n"
|
|
|
-"X-Content-Type-Options: nosniff\r\n"
|
|
|
-"X-XSS-Protection: 1; mode=block\r\n"
|
|
|
-"Date: Thu, 01 Jan 1970 23:13:59 GMT\r\n"
|
|
|
-"Connection: Keep-Alive\r\n"
|
|
|
-"Accept-Ranges: bytes\r\n"
|
|
|
-"File Data: 238 bytes\r\n"
|
|
|
-;
|
|
|
-#endif
|
|
|
static int http_reply(void *conn, int status, char *ack)
|
|
|
{
|
|
|
int r=0;
|
|
|
@@ -101,7 +86,8 @@ static int http_reply(void *conn, int status, char *ack)
|
|
|
httpFinalize(s);
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
- mg_http_reply(s->c, status, "", "%s", ack);
|
|
|
+ // mg_http_reply(s->c, status, "", "%s", ack);
|
|
|
+ mg_http_reply(s->c, status, "", ack);
|
|
|
#endif
|
|
|
|
|
|
return r;
|
|
|
@@ -318,7 +304,6 @@ void* update_thread(void* arg)
|
|
|
}
|
|
|
//else if (gdm->view_page==3)
|
|
|
{
|
|
|
-
|
|
|
upgrade_msg =ws_sensor_status_ack_to_json(&__globalDeviceManage._globalSensorManger);
|
|
|
websocket_send(upgrade_msg, strlen(upgrade_msg));
|
|
|
cJSON_free((void*)upgrade_msg);
|
|
|
@@ -327,9 +312,14 @@ void* update_thread(void* arg)
|
|
|
// pthread_mutex_unlock(&Websocketlock);
|
|
|
//log_i("ws upload.");
|
|
|
}
|
|
|
- usleep(1000*1000);
|
|
|
+
|
|
|
+ int npoll=websocket_poll();
|
|
|
+ // log_i("ws poll once! status=%d\n", npoll);
|
|
|
+
|
|
|
+ usleep(500*1000);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ websocket_free() ;
|
|
|
pthread_exit(NULL);
|
|
|
}
|
|
|
|
|
|
@@ -366,7 +356,7 @@ static void changeLanguages(void* conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
json_to_switch_language(rx_body_buf);
|
|
|
dev_update_device_genera_info(__globalDeviceManage.db,__globalDeviceManage._global_device_info);
|
|
|
@@ -388,7 +378,7 @@ static void loginFunc(void* conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//用户信息创建-未析构
|
|
|
@@ -470,7 +460,7 @@ static void loginOutFunc(void* conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -535,7 +525,7 @@ static void overallStatusMonitoring(void* conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -982,7 +972,7 @@ static void channelStatusMonitoring(void* conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -1507,7 +1497,7 @@ static void sensorStatusMonitoring(void* conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
//转换json参数
|
|
|
cjson = json_to_sensor_manage(rx_body_buf,&_over_all_sensor_request);
|
|
|
@@ -1992,7 +1982,7 @@ static void alarmProtect(void *conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
memset(&_alarm_request_info, 0, sizeof(_alarm_request_info));
|
|
|
@@ -2269,7 +2259,7 @@ static void logInformation(void *conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
memset(&__logInformationRequestInfo,0,sizeof(_LogInformationRequestInfo));
|
|
|
@@ -2464,7 +2454,7 @@ static void communicationManagement(void *conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -2564,7 +2554,7 @@ static void serviceManagement(void *conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -3290,7 +3280,7 @@ static void systemManagent(void *conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -3456,7 +3446,7 @@ static void equipmentMintenance(void *conn)
|
|
|
#else
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
struct mg_http_message *msg=s->ev_data;
|
|
|
- rx_body_buf = msg->body.buf;
|
|
|
+ rx_body_buf = msg->body.ptr;
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
@@ -3509,6 +3499,7 @@ static void equipmentMintenance(void *conn)
|
|
|
{
|
|
|
diff = ts.tv_sec;
|
|
|
}
|
|
|
+ _over_back_sts_info.product_runTime = malloc(32);
|
|
|
sprintf(_over_back_sts_info.product_runTime, "%02ld:%02ld:%02ld", diff / 3600, (diff % 3600) / 60, diff % 60);
|
|
|
_over_back_sts_info.productAddr = getLocalIpAddress("eth0");
|
|
|
|
|
|
@@ -3571,6 +3562,7 @@ static void equipmentMintenanceUpload(void *conn)
|
|
|
HttpStream *s=(HttpStream*)conn;
|
|
|
http_reply(conn, 200, NULL);
|
|
|
#else
|
|
|
+/*
|
|
|
mg_stream_t *s=(mg_stream_t*)conn;
|
|
|
upload_stat_t *us = (upload_stat_t *) s->c->data;
|
|
|
struct mg_fs *fs = &mg_fs_posix;
|
|
|
@@ -3604,6 +3596,8 @@ static void equipmentMintenanceUpload(void *conn)
|
|
|
s->c->is_draining = 1; // Close connection when response gets sent
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ */
|
|
|
#endif
|
|
|
}
|
|
|
|