xusl vor 1 Jahr
Ursprung
Commit
139edf8926

+ 17 - 29
backend/src/main/java/com/jiayue/pfr/service/alg/listener/AgcLockListener.java

@@ -19,6 +19,7 @@ import wei.yigulu.iec104.nettyconfig.Iec104MasterBuilder;
 import wei.yigulu.iec104.util.CommandWaiter;
 import wei.yigulu.iec104.util.SendAndReceiveNumUtil;
 import wei.yigulu.iec104.util.SendCommandHelper;
+import wei.yigulu.netty.AbstractMasterBuilder;
 
 /**
  * 给AGC闭锁
@@ -32,8 +33,8 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
 
     @Autowired
     BizYaoDataService bizYaoDataService;
-//    @Autowired
-//    Iec104MasterBuilder iec104MasterBuilder;
+    @Autowired
+    Iec104MasterBuilder iec104MasterBuilder;
 
     @Async
     @Override
@@ -44,36 +45,23 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
             // 动作
             fLogger.info("给AGC闭锁开始");
 
-            SingleBooleanCommand command = new SingleBooleanCommand();
-            Apdu apdu = new Apdu();
-            Asdu asdu = command.generateBack();
-            asdu.setCommonAddress(1);
-            asdu.getCot().setNot(6);
-            asdu.getVsq().setSq(0);
-            asdu.getVsq().setNum(1);
-            asdu.setOriginatorAddress(0);
-            command.setAddresses(new InformationBodyAddress(25089));
-            command.setVal(new IeSingleBooleanCommand(true));
-
-            apdu.setAsdu(asdu);
-
-//            CommandWaiter commandWaiter = new CommandWaiter(iec104MasterBuilder.getFuture().channel().id(), apdu, command.getAddresses().getAddress());
+//            SingleBooleanCommand command = new SingleBooleanCommand();
+//            Apdu apdu = new Apdu();
+//            Asdu asdu = command.generateBack();
+//            asdu.setCommonAddress(1);
+//            asdu.getCot().setNot(6);
+//            asdu.getVsq().setSq(0);
+//            asdu.getVsq().setNum(1);
+//            asdu.setOriginatorAddress(0);
+//            command.setAddresses(new InformationBodyAddress(25089));
+//            command.setVal(new IeSingleBooleanCommand(true));
+//
+//            apdu.setAsdu(asdu);
 
-            // 接收闭锁回复?
+            SendCommandHelper.sendBooleanCommand(iec104MasterBuilder.getIec104Master(), 0,1, 25089, true);
+//                    (apdu, iec104MasterBuilder.iec104MasterBuilder());
 
 
-//            SendAndReceiveNumUtil.sendIFrame(apdu, iec104MasterBuilder.getFuture().channel(), iec104MasterBuilder.getLog());
-//            CommandWaiter commandWaiter = new CommandWaiter(iec104MasterBuilder.getFuture().channel().id(), apdu, dataAddress);
-//            commandWaiters.add(commandWaiter);
-//
-//            IecDataInterface data;
-//            try {
-//                data = commandWaiter.get();
-//            } catch (Exception var14) {
-//                throw var14;
-//            } finally {
-//                commandWaiters.remove(commandWaiter);
-//            }