/* 自动生成的文本数据头文件 */ /* 源文件: ws.js */ /* 文件大小: 3306 字节 */ /* 生成时间: 2025-09-16 05:47:25 */ /* 编码: utf-8 */ #ifndef P_WS_H #define P_WS_H #include // 文本数据(UTF-8编码) const char *p_ws = "let productTypeData = {\n" "};\n" "let data_alarm = [];\n" "let sensorc_list = [];\n" "let network_data = {}\n" " // 485配置\n" "let cas_data = {}\n" " // snmp\n" "let snmp_data = {}\n" " // 设备信息\n" "let lang_data = {}\n" "let sensor_data = {}\n" "let his_alarm = []\n" "function on_ws_msg(js) {\n" " console.log(\"执行\")\n" " // debugger\n" " //总电源数据显示\n" " if (js.powert != undefined) {\n" " total_data = js.powert.total\n" " type = js.powert.type\n" " productTypeData.productType = type;\n" " total_Infor(js, total_data, type)\n" " }\n" " //通道电源数据显示\n" " if (js.powerc != undefined) {\n" " channel_power_infro = js.powerc\n" " channel_infro = channel_power_infro.power\n" " alarm = js.powerc.alarm\n" " channel_number = js.powerc.info // 通道基础信息\n" " channel_power = js.powerc.power\n" " j_data = js\n" " // 通道号\n" " Channel_Info(j_data, channel_power_infro)\n" " // 阈值设置\n" " threshold_mannage(js, channel_power_infro)\n" " // systemAlarm(alarm)\n" " //populateTable(j_data,channel_power)\n" " }\n" " // 警告\n" " if (js.alarmd != undefined) {\n" " alarmd_data = js.alarmd\n" " data_alarm = [];\n" " data_alarm = alarm_process(alarmd_data)\n" " }\n" " // 配置信息(网络配置,485配置,snmp,设备信息)\n" " if (js.cas != undefined) {\n" " cas_data = js.cas;\n" " }\n" " if (js.network != undefined) {\n" " network_data = js.network\n" " }\n" " if (js.snmp != undefined) {\n" " snmp_data = js.snmp\n" " console.log(\"snmp数据--》\")\n" " console.log(snmp_data)\n" " }\n" " if (js.sensorc != undefined) {\n" " sensor_data = js.sensorc;\n" " }\n" " // if (js.paras != undefined) {\n" " // // 设备信息\n" " // lang_data = js.paras.lang\n" " // }\n" " if (js.sensorc != undefined) {\n" " sensorc_list = [];\n" " // 传感器\n" " sensorc_list = js.sensorc\n" " // console.log(sensorc_list)\n" " }\n" " if (js.sys != undefined) {\n" " lang_data = js.sys\n" " // console.log(lang_data)\n" " }\n" " if (js.his_alarmd != undefined) {\n" " his_alarm = js.his_alarmd;\n" " console.log(his_alarm)\n" " }\n" "}\n" "function alarm_process(alarmd_data) {\n" " const result = [];\n" " const alarmProperties = alarmd_data.alarm;\n" " const baseProperties = {\n" " \"ch\": alarmd_data.ch,\n" " \"time\": alarmd_data.time\n" " };\n" " let idCounter = 1;\n" " for (const key in alarmProperties) {\n" " if (alarmProperties.hasOwnProperty(key) && alarmProperties[key] == 1) {\n" " const newObj = {...baseProperties, [key]: alarmProperties[key], \"id\": idCounter++ };\n" " result.push(newObj);\n" " }\n" " }\n" " return result;\n" "}\n" "function ws_hdr() {\n" " var proto = window.location.protocol,\n" " ws;\n" " if (proto == 'https:') {\n" " ws = 'wss://';\n" " } else {\n" " ws = 'ws://';\n" " }\n" " return ws;\n" "}\n" "function setActivePage(pageFunction, intervalTime) {\n" " // 停止之前活动的页面定时函数\n" " if (activePageIntervalId != null) {\n" " clearInterval(activePageIntervalId);\n" " }\n" " activePageIntervalId = setInterval(pageFunction, intervalTime);\n" "}\n" "ws = new WS('ws://'+window.location.host+'/ws',on_ws_msg);\n" "// ws = new WS('ws://192.168.1.134/ws', on_ws_msg);\n" "//ws = new WS('ws://192.168.1.134/websocket/TMS-WebSocket', on_ws_msg);" ; // 文本数据大小(包括null终止符) const size_t p_ws_size = 3307; // 文本长度(字符数) const size_t p_ws_length = 3148; #endif /* P_WS_H */