| | |
| | | public PLCManualJog() throws IOException {
|
| | | config = new Configuration("config.properties");
|
| | | }
|
| | |
|
| | | // Boolean[] values1 = { false, true, true, true, false, false, true, false,
|
| | | // false, true, true, true, false, false,
|
| | | // true, false,false, true, true, true, false, false, true, false,
|
| | | // false, true, false, true };
|
| | | // List<Boolean> arraylist = new ArrayList<>(Arrays.asList(values1));
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | |
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | // this.readValue();
|
| | | // String PlcAddress = this.name;
|
| | | // Integer Plccount = this.count;
|
| | |
|
| | | // System.out.println(stt);
|
| | |
|
| | |
|
| | | List<String> addressList21 = Arrays.asList(config.getProperty("PLCManualJog.button").split(","));
|
| | |
|
| | |
|
| | | List<Boolean> arraylist = S7control.getinstance().readBits(addressList21);
|
| | |
|
| | | // Boolean[] values1 = { false, true, true, true, false, false, true, false,
|
| | | // false, true, true, true, false, false,
|
| | | // true, false };
|
| | | // List<Boolean> arraylist = new ArrayList<>(Arrays.asList(values1));
|
| | | // Boolean[] values2 = { false, true, true, true, false, false, true, false };
|
| | | // List<Boolean> arraylist2 = new ArrayList<>(Arrays.asList(values2));
|
| | | // Boolean[] values3 = { false, false };
|
| | | // List<Boolean> arraylist3 = new ArrayList<>(Arrays.asList(values3));
|
| | | List<String> addressList21 = Arrays.asList(config.getProperty("PLCManualJog.button").split(","));
|
| | | List<Boolean> arraylist = S7control.getinstance().readBits(addressList21);
|
| | |
|
| | |
|
| | | JSONObject jsonObject = new JSONObject();
|
| | |
| | | boolean value = arraylist.get(i);
|
| | | params[i] = value ? (short) 1 : (short) 0;
|
| | | }
|
| | |
|
| | | // System.out.println("messageValue:"+ arraylist );
|
| | | jsonObject.append("params", params);
|
| | |
|
| | | // System.out.println("messageValue:" + arraylist +"messageValue2:" + arraylist2 );
|
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("ManualJog");
|
| | | // if (sendwServer != null) {
|
| | | // sendwServer.sendMessage(jsonObject.toString());
|
| | | // }
|
| | |
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("ManualJog");
|
| | | if (sendwServer != null) {
|
| | |
| | | List<Boolean> bolList = new ArrayList<>();
|
| | |
|
| | |
|
| | | for (int i = 0; i < 26 && i < messageBooleans.size(); i++) {
|
| | | for (int i = 0; i < 28 && i < messageBooleans.size(); i++) {
|
| | | bolList.add(messageBooleans.get(i));
|
| | | }
|
| | |
|
| | |
|
| | | if (!bolList.isEmpty()) {
|
| | | S7control.getinstance().WriteBit(addressList21, bolList);
|
| | | S7control.getinstance().WriteBit(addressList21, bolList);
|
| | | // arraylist.clear();
|
| | | // arraylist.addAll(bolList);
|
| | |
|
| | | System.out.println("messageValue:" + bolList + " written to PLC at address " + addressList21);
|
| | | }
|
| | |
|