From 769f2ebbacd3dd9dfea317326a9e5d450c345012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Mon, 8 May 2023 16:08:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=AE=AF=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/bpa/app/DeviceData.java | 78 +++++++------------ 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/com/example/bpa/app/DeviceData.java b/app/src/main/java/com/example/bpa/app/DeviceData.java index 063769a..5582fc9 100644 --- a/app/src/main/java/com/example/bpa/app/DeviceData.java +++ b/app/src/main/java/com/example/bpa/app/DeviceData.java @@ -73,50 +73,38 @@ public class DeviceData { } }); - //获取称当前重量 -// ModbusTcpServer.get().ReadInt("VD260", 9, new IReadCallBack() { -// @Override -// public void onSuccess(int[] ints) { -// for (int i = 0; i < ints.length; i++) { -// CallCurrentWeight.put(i + 1, ints[i]); -// } +// //获取称当前重量 +// ModbusTcpServer.get().ReadInt("VD260", 9, ints -> { +// for (int i = 0; i < ints.length; i++) { +// CallCurrentWeight.put(i + 1, ints[i]); // } // }); - - //获取校准基准时间 -// ModbusTcpServer.get().ReadInt("VD124", 1, new IReadCallBack() { -// @Override -// public void onSuccess(int[] ints) { -// CalibrationReferenceTime = ints[0]; -// } +// +// //获取校准基准时间 +// ModbusTcpServer.get().ReadInt("VD124", 1, ints -> { +// CalibrationReferenceTime = ints[0]; // }); - - //获取清洗参数 -// ModbusTcpServer.get().ReadShort("VW140", 4, new IReadCallBack() { -// @Override -// public void onSuccess(short[] shorts) { -// DrainageTime = shorts[0]; -// AddCleaningAgentTime = shorts[1]; -// InletTime = shorts[2]; -// CyclicCleaningTime = shorts[3]; -// } +// +// //获取清洗参数 +// ModbusTcpServer.get().ReadShort("VW140", 4, shorts -> { +// DrainageTime = shorts[0]; +// AddCleaningAgentTime = shorts[1]; +// InletTime = shorts[2]; +// CyclicCleaningTime = shorts[3]; // }); - - //获取清洗参数 -// ModbusTcpServer.get().ReadBool("M6.5", 1, new IReadCallBack() { -// @Override -// public void onSuccess(boolean[] booleans) { -// WeightCalibrationMode = booleans[0]; -// } +// +// //获取清洗参数 +// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { +// WeightCalibrationMode = booleans[0]; // }); - - //配料完成 M0.3 +// +// //配料完成 M0.3 // CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); - - //清洗完成 M0.6 +// +// //清洗完成 M0.6 // CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); - - //去皮完成 M1.3 +// +// //去皮完成 M1.3 // CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); Thread.sleep(10); @@ -140,17 +128,11 @@ public class DeviceData { * @param callback 执行委托 */ private void CompleteListen(String add, String name, IRun callback) { - ModbusTcpServer.get().ReadBool(add, 1, new IReadCallBack() { - @Override - public void onSuccess(boolean[] booleans) { - RTrig.get(name).Start(booleans[0], new IRun() { - @Override - public void Run() { - if (callback != null) - callback.Run(); - } - }); - } + ModbusTcpServer.get().ReadBool(add, 1, booleans -> { + RTrig.get(name).Start(booleans[0], () -> { + if (callback != null) + callback.Run(); + }); }); } //endregion