| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- /* 自动生成的文本数据头文件 */
- /* 源文件: ws.js */
- /* 文件大小: 3315 字节 */
- /* 生成时间: 2026-01-10 02:29:37 */
- /* 编码: utf-8 */
- #ifndef P_WS_H
- #define P_WS_H
- #include <stddef.h>
- // 文本数据(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.166/ws', on_ws_msg);\n"
- " // ws = new WS('ws://192.168.1.79/websocket/TMS-WebSocket', on_ws_msg);"
- ;
- // 文本数据大小(包括null终止符)
- const size_t p_ws_size = 3316;
- // 文本长度(字符数)
- const size_t p_ws_length = 3157;
- #endif /* P_WS_H */
|