yzt
2023-05-26 2f70f6727314edd84d8ec2bfe3ce832803f1ea77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.hxzkoa.udp;
 
import com.hxzkoa.json.tb_gas;
import com.hxzkoa.util.Config;
import com.hxzkoa.util.HttpUtil;
 
import net.sf.json.JSONObject;
 
public class gasSensor {
    /*
     * gas_sensor,[length],[weizhi],[gastype],[nongdu],[caijidizhi],[tongdao],[warning],[ip],[x],[y],[mark]
     * 
     */
    public static void sensor(String message) {
        String[] dis = message.split(",");
        String wei_zhi = dis[2];
        String gas_type = dis[3];
        String nong_du = dis[4];
        String collect_ip = dis[5];
        String tong_dao = dis[6];
        String waring_zhi = dis[7];
        String ip = dis[8];
        String x= dis[9];
        String y = dis[10];
        String postUrl = Config.getPostUrl()+"sensorManagement_bw.do";
        // 更改标签的状态和电量信息
        tb_gas sensor = new tb_gas();
        sensor.setWei_zhi(wei_zhi);
        sensor.setGas_type(gas_type);
        sensor.setNong_du(nong_du);
        sensor.setCollect_ip(collect_ip);
        sensor.setTong_dao(tong_dao);
        sensor.setWaring_zhi(waring_zhi);
        sensor.setIp(ip);
        sensor.setX(x);
        sensor.setY(y);
        JSONObject tagObject = JSONObject.fromObject(sensor);
        HttpUtil.doPost(postUrl, tagObject.toString(), "UTF-8");
        dis = null;
    }
 
}