From 0625bf12714e3a7cca5c47ed09a50417b1384a72 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 22 May 2024 10:11:10 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E5=85=89=E7=94=B5=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shangdianke/ItemProtocol.java | 40 ++++++++-------- .../PhotoelectricDetectionDeviceDriver.java | 47 +++++++++---------- ...otoelectricDetectionStationDefinition.java | 10 ++-- 3 files changed, 48 insertions(+), 49 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/ItemProtocol.java index 21bac5b..fd34a3c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/ItemProtocol.java @@ -14,12 +14,12 @@ public class ItemProtocol { /** * 心跳 */ - public static final String ITEM_HEARTBEAT = "heartbeat"; +// public static final String ITEM_HEARTBEAT = "heartbeat"; /** * 工作模式 */ - public static final String ITEM_MODE = "mode"; +// public static final String ITEM_MODE = "mode"; /** * 光电信号 @@ -29,17 +29,17 @@ public class ItemProtocol { /** * 动作信号 */ - public static final String ITEM_ACTION = "action"; +// public static final String ITEM_ACTION = "action"; /** * 报警信号 */ - public static final String ITEM_ERROR = "error"; +// public static final String ITEM_ERROR = "error"; /** * 下发命令 */ - public static final String ITEM_TO_COMMAND = "to_command"; +// public static final String ITEM_TO_COMMAND = "to_command"; boolean isOnline; @@ -60,22 +60,22 @@ public class ItemProtocol { } } - public int getHeartbeat() { - return this.getOpcIntegerValue(ItemProtocol.ITEM_HEARTBEAT); - } - public int getMode() { - return this.getOpcIntegerValue(ItemProtocol.ITEM_MODE); - } +// public int getHeartbeat() { +// return this.getOpcIntegerValue(ItemProtocol.ITEM_HEARTBEAT); +// } +// public int getMode() { +// return this.getOpcIntegerValue(ItemProtocol.ITEM_MODE); +// } public int getMove() { return this.getOpcIntegerValue(ItemProtocol.ITEM_MOVE); } - public int getAction() { - return this.getOpcIntegerValue(ItemProtocol.ITEM_ACTION); - } - public int getError() { - return this.getOpcIntegerValue(ItemProtocol.ITEM_ERROR); - } - public int getToCommand() { - return this.getOpcIntegerValue(ItemProtocol.ITEM_TO_COMMAND); - } +// public int getAction() { +// return this.getOpcIntegerValue(ItemProtocol.ITEM_ACTION); +// } +// public int getError() { +// return this.getOpcIntegerValue(ItemProtocol.ITEM_ERROR); +// } +// public int getToCommand() { +// return this.getOpcIntegerValue(ItemProtocol.ITEM_TO_COMMAND); +// } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionDeviceDriver.java index b355ff3..8bb7cae 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionDeviceDriver.java @@ -38,38 +38,38 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver /** * 心跳 */ - private int heartbeat = 0; - private int lastHeartbeat = this.heartbeat; +// private int heartbeat = 0; +// private int lastHeartbeat = this.heartbeat; /** * 工作模式 */ - private int mode = 0; - private int lastMode = this.mode; +// private int mode = 0; +// private int lastMode = this.mode; /** * 光电信号 */ private int move = 0; - private int lastMove = this.move; + private int lastMove = 0; /** * 动作信号 */ - private int action = 0; - private int lastAction = this.action; +// private int action = 0; +// private int lastAction = this.action; /** * 报警信号 */ - private int error = 0; - private int lastError = this.error; +// private int error = 0; +// private int lastError = this.error; /** * 下发命令 */ - private int toCommand = 0; - private int lastToCommand = this.toCommand; +// private int toCommand = 0; +// private int lastToCommand = this.toCommand; private static final int MODE = 3; @@ -97,12 +97,12 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver try { this.currentDeviceCode = this.getDeviceCode(); - this.heartbeat = this.itemProtocol.getHeartbeat(); - this.mode = this.itemProtocol.getMode(); +// this.heartbeat = this.itemProtocol.getHeartbeat(); +// this.mode = this.itemProtocol.getMode(); this.move = this.itemProtocol.getMove(); - this.action = this.itemProtocol.getAction(); - this.error = this.itemProtocol.getError(); - this.toCommand = this.itemProtocol.getToCommand(); +// this.action = this.itemProtocol.getAction(); +// this.error = this.itemProtocol.getError(); +// this.toCommand = this.itemProtocol.getToCommand(); if (this.move != this.lastMove) { if (move == 0) { @@ -110,7 +110,8 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver } } - if (mode > 0 && !requireSuccess) { +// if (mode > 0 && !requireSuccess) { + if (!requireSuccess) { Object methodName = this.device.getExtraValue().get(String.valueOf(MODE)); if (ObjectUtil.isNotEmpty(methodName)) { try { @@ -135,12 +136,12 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver log.error(e.getMessage(), e); return; } - this.lastHeartbeat = this.heartbeat; - this.lastMode = this.mode; +// this.lastHeartbeat = this.heartbeat; +// this.lastMode = this.mode; this.lastMove = this.move; - this.lastAction = this.action; - this.lastError = this.error; - this.lastToCommand = this.toCommand; +// this.lastAction = this.action; +// this.lastError = this.error; +// this.lastToCommand = this.toCommand; } private void executionMethodByMode(String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { @@ -196,6 +197,4 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver itemMap.put(to_param, value); this.control(itemMap); } - - } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionStationDefinition.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionStationDefinition.java index f62d55d..5510cbb 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionStationDefinition.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionStationDefinition.java @@ -52,18 +52,18 @@ public class PhotoelectricDetectionStationDefinition implements OpcDeviceDriverD @Override public List getReadableItemDTOs() { ArrayList itemDTOs = new ArrayList<>(); - itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_HEARTBEAT, "心跳", "")); - itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_MODE, "工作模式", "")); +// itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_HEARTBEAT, "心跳", "")); +// itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_MODE, "工作模式", "")); itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_MOVE, "光电信号", "")); - itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_ACTION, "动作信号", "")); - itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_ERROR, "报警信号", "")); +// itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_ACTION, "动作信号", "")); +// itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_ERROR, "报警信号", "")); return itemDTOs; } @Override public List getWriteableItemDTOs() { ArrayList itemDTOs = new ArrayList<>(); - itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_TO_COMMAND, "下发命令", "")); +// itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_TO_COMMAND, "下发命令", "")); return itemDTOs; } }