|
@ -38,38 +38,38 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver |
|
|
/** |
|
|
/** |
|
|
* 心跳 |
|
|
* 心跳 |
|
|
*/ |
|
|
*/ |
|
|
private int heartbeat = 0; |
|
|
// private int heartbeat = 0;
|
|
|
private int lastHeartbeat = this.heartbeat; |
|
|
// private int lastHeartbeat = this.heartbeat;
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 工作模式 |
|
|
* 工作模式 |
|
|
*/ |
|
|
*/ |
|
|
private int mode = 0; |
|
|
// private int mode = 0;
|
|
|
private int lastMode = this.mode; |
|
|
// private int lastMode = this.mode;
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 光电信号 |
|
|
* 光电信号 |
|
|
*/ |
|
|
*/ |
|
|
private int move = 0; |
|
|
private int move = 0; |
|
|
private int lastMove = this.move; |
|
|
private int lastMove = 0; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 动作信号 |
|
|
* 动作信号 |
|
|
*/ |
|
|
*/ |
|
|
private int action = 0; |
|
|
// private int action = 0;
|
|
|
private int lastAction = this.action; |
|
|
// private int lastAction = this.action;
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 报警信号 |
|
|
* 报警信号 |
|
|
*/ |
|
|
*/ |
|
|
private int error = 0; |
|
|
// private int error = 0;
|
|
|
private int lastError = this.error; |
|
|
// private int lastError = this.error;
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 下发命令 |
|
|
* 下发命令 |
|
|
*/ |
|
|
*/ |
|
|
private int toCommand = 0; |
|
|
// private int toCommand = 0;
|
|
|
private int lastToCommand = this.toCommand; |
|
|
// private int lastToCommand = this.toCommand;
|
|
|
|
|
|
|
|
|
private static final int MODE = 3; |
|
|
private static final int MODE = 3; |
|
|
|
|
|
|
|
@ -97,12 +97,12 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
this.currentDeviceCode = this.getDeviceCode(); |
|
|
this.currentDeviceCode = this.getDeviceCode(); |
|
|
this.heartbeat = this.itemProtocol.getHeartbeat(); |
|
|
// this.heartbeat = this.itemProtocol.getHeartbeat();
|
|
|
this.mode = this.itemProtocol.getMode(); |
|
|
// this.mode = this.itemProtocol.getMode();
|
|
|
this.move = this.itemProtocol.getMove(); |
|
|
this.move = this.itemProtocol.getMove(); |
|
|
this.action = this.itemProtocol.getAction(); |
|
|
// this.action = this.itemProtocol.getAction();
|
|
|
this.error = this.itemProtocol.getError(); |
|
|
// this.error = this.itemProtocol.getError();
|
|
|
this.toCommand = this.itemProtocol.getToCommand(); |
|
|
// this.toCommand = this.itemProtocol.getToCommand();
|
|
|
|
|
|
|
|
|
if (this.move != this.lastMove) { |
|
|
if (this.move != this.lastMove) { |
|
|
if (move == 0) { |
|
|
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)); |
|
|
Object methodName = this.device.getExtraValue().get(String.valueOf(MODE)); |
|
|
if (ObjectUtil.isNotEmpty(methodName)) { |
|
|
if (ObjectUtil.isNotEmpty(methodName)) { |
|
|
try { |
|
|
try { |
|
@ -135,12 +136,12 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver |
|
|
log.error(e.getMessage(), e); |
|
|
log.error(e.getMessage(), e); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
this.lastHeartbeat = this.heartbeat; |
|
|
// this.lastHeartbeat = this.heartbeat;
|
|
|
this.lastMode = this.mode; |
|
|
// this.lastMode = this.mode;
|
|
|
this.lastMove = this.move; |
|
|
this.lastMove = this.move; |
|
|
this.lastAction = this.action; |
|
|
// this.lastAction = this.action;
|
|
|
this.lastError = this.error; |
|
|
// this.lastError = this.error;
|
|
|
this.lastToCommand = this.toCommand; |
|
|
// this.lastToCommand = this.toCommand;
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void executionMethodByMode(String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { |
|
|
private void executionMethodByMode(String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { |
|
@ -196,6 +197,4 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver |
|
|
itemMap.put(to_param, value); |
|
|
itemMap.put(to_param, value); |
|
|
this.control(itemMap); |
|
|
this.control(itemMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|