clll
2023-09-11 62a3bea35d7d046881f3934c5ca63895c4383aeb
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
package com.example.springboot.component;
 
import cn.hutool.json.JSONObject;
 
import java.util.ArrayList;
import java.util.List;
 
public class Plcsign extends Thread {
  @Override
  public void run() {
    while (this != null) {
      try {
        Thread.sleep(10000);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
 
      List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.DBX0.0", 58);
      if (plclist == null) {
 
      } else {
        JSONObject jsonObject = new JSONObject();
        // jsonObject3.append("sig",
        // new short[] { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
        // 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        // 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
        // });
        jsonObject.append("sig", plclist);
        WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign");
        if (sendwServer3 != null) {
          sendwServer3.sendMessage(jsonObject.toString());
        }
 
      }
    }
  }
}