Browse Source

通讯库修改

master
pry 1 year ago
parent
commit
769f2ebbac
1 changed files with 30 additions and 48 deletions
  1. +30
    -48
      app/src/main/java/com/example/bpa/app/DeviceData.java

+ 30
- 48
app/src/main/java/com/example/bpa/app/DeviceData.java View File

@@ -73,50 +73,38 @@ public class DeviceData {
}
});

//获取称当前重量
// ModbusTcpServer.get().ReadInt("VD260", 9, new IReadCallBack<int[]>() {
// @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<int[]>() {
// @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<short[]>() {
// @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<boolean[]>() {
// @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<boolean[]>() {
@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


Loading…
Cancel
Save