Browse Source

wait for status query to finish

Martin Kunz 2 years ago
parent
commit
c126a8cd5d

+ 1 - 1
pom.xml

@@ -77,7 +77,7 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <version>1.7.28</version>
+            <version>1.7.30</version>
         </dependency>
 		<dependency>
 			<groupId>com.digitalpetri.modbus</groupId>

+ 2 - 1
src/main/java/at/acdp/urweb/fhpp/FHMaster.java

@@ -36,7 +36,8 @@ public class FHMaster implements IFHMaster {
         master = new ModbusTcpMaster(config);
         while(true) {
             Thread.sleep(1000);
-            readStatus();
+            CompletableFuture<Status> s = readStatus();
+            s.join();
         }
     }
 

+ 0 - 14
src/main/java/at/acdp/urweb/fhpp/FHMasterSim.java

@@ -1,23 +1,9 @@
-
-
 package at.acdp.urweb.fhpp;
 
 import at.acdp.urweb.Params;
-import com.digitalpetri.modbus.codec.Modbus;
-import com.digitalpetri.modbus.master.ModbusTcpMaster;
-import com.digitalpetri.modbus.master.ModbusTcpMasterConfig;
-import com.digitalpetri.modbus.requests.ModbusRequest;
-import com.digitalpetri.modbus.requests.ReadHoldingRegistersRequest;
-import com.digitalpetri.modbus.requests.WriteMultipleRegistersRequest;
-import com.digitalpetri.modbus.responses.ReadHoldingRegistersResponse;
-import io.netty.util.ReferenceCountUtil;
-import io.netty.util.concurrent.CompleteFuture;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Timer;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;