|
|
@@ -9,7 +9,6 @@
|
|
|
#include "cfg.h"
|
|
|
|
|
|
|
|
|
-#define WEB_DEBUG
|
|
|
|
|
|
#if 0
|
|
|
#define LOGD log_d
|
|
|
@@ -62,19 +61,19 @@ typedef struct {
|
|
|
static web_handle_t webHandle;
|
|
|
|
|
|
|
|
|
-static char* g_product_board_cpu[2] = {
|
|
|
+static char* g_product_board_cpu[] = {
|
|
|
"xxx",
|
|
|
"T113"
|
|
|
};
|
|
|
|
|
|
-static char* g_product_type_str[4] = {
|
|
|
+static char* g_product_type_str[] = {
|
|
|
"SmartPdu(DC)",
|
|
|
"SmartPdu(AC)",
|
|
|
"SmartPdu(Tree_AC_Tree)",
|
|
|
"SmartPdu(Tree_AC_One)",
|
|
|
};
|
|
|
|
|
|
-static char* g_product_pwr_type_str[5] = {
|
|
|
+static char* g_product_pwr_type_str[] = {
|
|
|
"xxx",
|
|
|
"直流",
|
|
|
"交流单相",
|
|
|
@@ -111,8 +110,7 @@ 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, ack, "");
|
|
|
- mg_http_reply(s->c, status, hdr_str, "%s", ack);
|
|
|
+ mg_http_reply(s->c, status, "Content-Type: text/html\r\n", "%s", ack);
|
|
|
#endif
|
|
|
|
|
|
return r;
|
|
|
@@ -340,9 +338,13 @@ static void changeLanguages(void* conn)
|
|
|
/// @param stream
|
|
|
static void loginFunc(void* conn)
|
|
|
{
|
|
|
+ int ack_code=0;
|
|
|
char* ack_str = NULL ;
|
|
|
char g_token[64] = {0};
|
|
|
cchar* rx_body_buf = NULL;
|
|
|
+
|
|
|
+ LOGD("___ loginFunc 000\n");
|
|
|
+
|
|
|
#ifdef USE_WEBAPP
|
|
|
HttpStream *s=(HttpStream*)conn;
|
|
|
rx_body_buf = httpGetBodyInput(s);
|
|
|
@@ -398,7 +400,6 @@ static void loginFunc(void* conn)
|
|
|
//记录token
|
|
|
strcpy(_newUserLogin->user_token,g_token);
|
|
|
|
|
|
- int ack_code=0;
|
|
|
if (!LoginFlag)
|
|
|
{
|
|
|
ack_str = log_LoginFailedinfo_to_json();
|
|
|
@@ -411,9 +412,9 @@ static void loginFunc(void* conn)
|
|
|
ack_str = log_info_to_json(g_token);
|
|
|
ack_code = 200;
|
|
|
}
|
|
|
+
|
|
|
http_reply(conn, ack_code, ack_str);
|
|
|
cJSON_free((void*)ack_str);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/// @brief 注销信息
|
|
|
@@ -435,7 +436,7 @@ static void loginOutFunc(void* conn)
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
- if(json_to_User_loginOut_info(rx_body_buf,g_token)!=0)
|
|
|
+ if(json_to_User_loginOut_info(rx_body_buf,&g_token)!=0)
|
|
|
{
|
|
|
http_reply(conn, 400, NULL);
|
|
|
return ;
|
|
|
@@ -443,8 +444,7 @@ static void loginOutFunc(void* conn)
|
|
|
|
|
|
ack_str = log_info_to_json(g_token);
|
|
|
http_reply(conn, 200, ack_str);
|
|
|
-
|
|
|
- cJSON_free((void*)ack_str);
|
|
|
+ free(g_token);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -471,7 +471,6 @@ static void getUserRouters(void* conn)
|
|
|
|
|
|
ack_str = user_routers_info_to_json();
|
|
|
http_reply(conn, 200, ack_str);
|
|
|
-
|
|
|
cJSON_free((void*)ack_str);
|
|
|
}
|
|
|
|
|
|
@@ -505,9 +504,6 @@ static void overallStatusMonitoring(void* conn)
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
- LOGD("___all.type: %s\n", all.type);
|
|
|
- return;
|
|
|
-
|
|
|
req.obj = OBJ_OVERALL;
|
|
|
req.ch = 0;
|
|
|
req.prodChName[0] = 0;
|
|
|
@@ -655,14 +651,13 @@ static void channelStatusMonitoring(void* conn)
|
|
|
#endif
|
|
|
|
|
|
//转换json参数
|
|
|
- memset(&ch,0,sizeof(_OverChnPwrRequest));
|
|
|
+ memset(&ch, 0, sizeof(ch));
|
|
|
+
|
|
|
if(json_to_chn_pwr_status_monitor(rx_body_buf,&ch)!=0)
|
|
|
{
|
|
|
http_reply(conn, 400, NULL);
|
|
|
return ;
|
|
|
}
|
|
|
- LOGD("___ch.type: %s\n", ch.type);
|
|
|
- return;
|
|
|
|
|
|
req.obj = OBJ_CHANNEL;
|
|
|
req.ch = ch.productChId;
|
|
|
@@ -1789,7 +1784,7 @@ static void communicationManagement(void *conn)
|
|
|
|
|
|
/// @brief 服务管理
|
|
|
/// @param stream
|
|
|
-static void serviceManagement(HttpStream *stream)
|
|
|
+static void serviceManagement(void *conn)
|
|
|
{
|
|
|
__globalDeviceManage.view_page=-1;
|
|
|
int ret = -1 ;
|
|
|
@@ -2613,12 +2608,12 @@ static void equipmentMintenance(void *conn)
|
|
|
http_reply(conn, 400, NULL);
|
|
|
return ;
|
|
|
}
|
|
|
+
|
|
|
//查询设备列表
|
|
|
if(strcmp(_Over_equipment_mintenance.type,"listSbRestartQuery")==0)
|
|
|
{
|
|
|
int i,r;
|
|
|
dev_list_t dl;
|
|
|
-
|
|
|
#if 0
|
|
|
r = cascade_get_devlist(&dl);
|
|
|
if(r==0) {
|
|
|
@@ -2628,10 +2623,9 @@ static void equipmentMintenance(void *conn)
|
|
|
#else
|
|
|
strcpy(_over_back_sts_info.product_name, __globalDeviceManage._global_device_info.product_name);
|
|
|
strcpy(_over_back_sts_info.product_number, __globalDeviceManage._global_device_info.product_number);
|
|
|
- _over_back_sts_info.product_id = atoi(__globalDeviceManage._global_device_info.product_id);
|
|
|
+ _over_back_sts_info.product_id = __globalDeviceManage._global_device_info.product_id;
|
|
|
strcpy(_over_back_sts_info.product_type, g_product_type_str[__globalDeviceManage._global_device_info.product_type]);
|
|
|
strcpy(_over_back_sts_info.product_status, __globalDeviceManage._global_device_info.product_status);
|
|
|
-
|
|
|
ack_str = over_product_list_info_to_json(&_over_back_sts_info);
|
|
|
#endif
|
|
|
|
|
|
@@ -2717,26 +2711,21 @@ static void equipmentMintenanceUpload(void *conn)
|
|
|
static int webSetCallback(void)
|
|
|
{
|
|
|
httpAddCallback("/login", loginFunc);//登录
|
|
|
-
|
|
|
httpAddCallback("/logout", loginOutFunc);//登出
|
|
|
httpAddCallback("/getInfo", getUserInfo);//获取用户信息
|
|
|
httpAddCallback("/pdu/changeLanguages", changeLanguages);//切换语言
|
|
|
-
|
|
|
httpAddCallback("/pdu/systemConfiguration", systemConfiguration);//登录
|
|
|
httpAddCallback("/getRouters", getUserRouters);//获取菜单接口
|
|
|
-
|
|
|
httpAddCallback("/pdu/overallStatusMonitoring", overallStatusMonitoring);//设备电源监控信息
|
|
|
httpAddCallback("/pdu/channelStatusMonitoring", channelStatusMonitoring);//设备通道电源监控信息
|
|
|
httpAddCallback("/pdu/sensorStatusMonitoring", sensorStatusMonitoring);//传感器总体请求信息
|
|
|
httpAddCallback("/pdu/alarmProtect", alarmProtect);//告警历史信息
|
|
|
httpAddCallback("/pdu/logInformation", logInformation);//日志
|
|
|
-
|
|
|
httpAddCallback("/pdu/communicationManagement", communicationManagement);//通信设置
|
|
|
httpAddCallback("/pdu/serviceManagement", serviceManagement);//服务管理
|
|
|
httpAddCallback("/pdu/system", systemManagent);//用户管理
|
|
|
httpAddCallback("/pdu/equipmentMintenance", equipmentMintenance);//设备重启
|
|
|
httpAddCallback("/pdu/equipmentMintenanceUpload", equipmentMintenanceUpload); //固件升级
|
|
|
-
|
|
|
|
|
|
return 0;
|
|
|
}
|