|
|
@ -1,4 +1,5 @@ |
|
|
|
package com.iflytop.digester.underframework.connection; |
|
|
|
import com.iflytop.digester.underframework.UfApplication; |
|
|
|
import com.iflytop.digester.underframework.dao.model.UfMdbActuator; |
|
|
|
import com.iflytop.digester.underframework.dao.model.UfMdbActuatorCmd; |
|
|
|
import com.iflytop.digester.underframework.dao.record.UfActiveRecord; |
|
|
@ -7,10 +8,14 @@ import com.iflytop.digester.underframework.util.UfClassHelper; |
|
|
|
import com.iflytop.digester.underframework.util.UfCommon; |
|
|
|
import org.java_websocket.client.WebSocketClient; |
|
|
|
import org.java_websocket.handshake.ServerHandshake; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URISyntaxException; |
|
|
|
import java.nio.ByteBuffer; |
|
|
|
import java.nio.ByteOrder; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Timer; |
|
|
@ -307,6 +312,18 @@ public class UfZcancmderWebsocket extends UfConnectionBase { |
|
|
|
// wait for actuator finish |
|
|
|
private void waitForActuatorFinish(UfMdbActuatorCmd actuatorCmd) { |
|
|
|
do { |
|
|
|
String filePath = UfApplication.getApp().getEnv().getProperty("app.emergency-stop-file-path"); |
|
|
|
if ( null != filePath ) { |
|
|
|
try { // read all content from file as string |
|
|
|
String state = Files.readString(Path.of(filePath)); |
|
|
|
if ( "0".equals(state.trim()) ) { |
|
|
|
return ; // emergency stop triggered |
|
|
|
} |
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var waitCmd = new UfMdbActuatorCmd(); |
|
|
|
waitCmd.actuatorId = actuatorCmd.actuatorId; |
|
|
|
waitCmd.cmdId = "0104"; |
|
|
@ -319,11 +336,7 @@ public class UfZcancmderWebsocket extends UfConnectionBase { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
Thread.sleep(100); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
UfCommon.delay(100); |
|
|
|
} while ( true ); |
|
|
|
} |
|
|
|
|
|
|
|