@ -1,81 +0,0 @@ |
|||||
package org.nl.acs.device_driver.shangdianke; |
|
||||
|
|
||||
import lombok.Getter; |
|
||||
import lombok.Setter; |
|
||||
|
|
||||
/** |
|
||||
* @author zhangjiangwei |
|
||||
*/ |
|
||||
@Getter |
|
||||
@Setter |
|
||||
public class ItemProtocol { |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 心跳 |
|
||||
*/ |
|
||||
public static final String ITEM_HEARTBEAT = "heartbeat"; |
|
||||
|
|
||||
/** |
|
||||
* 工作模式 |
|
||||
*/ |
|
||||
public static final String ITEM_MODE = "mode"; |
|
||||
|
|
||||
/** |
|
||||
* 光电信号 |
|
||||
*/ |
|
||||
public static final String ITEM_MOVE = "move"; |
|
||||
|
|
||||
/** |
|
||||
* 动作信号 |
|
||||
*/ |
|
||||
public static final String ITEM_ACTION = "action"; |
|
||||
|
|
||||
/** |
|
||||
* 报警信号 |
|
||||
*/ |
|
||||
public static final String ITEM_ERROR = "error"; |
|
||||
|
|
||||
/** |
|
||||
* 下发命令 |
|
||||
*/ |
|
||||
public static final String ITEM_TO_COMMAND = "to_command"; |
|
||||
|
|
||||
boolean isOnline; |
|
||||
|
|
||||
private final PhotoelectricDetectionDeviceDriver driver; |
|
||||
|
|
||||
public ItemProtocol(PhotoelectricDetectionDeviceDriver driver) { |
|
||||
this.driver = driver; |
|
||||
} |
|
||||
|
|
||||
public int getOpcIntegerValue(String protocol) { |
|
||||
Integer value = this.driver.getIntegeregerValue(protocol); |
|
||||
if (value == null) { |
|
||||
this.isOnline = false; |
|
||||
return 0; |
|
||||
} else { |
|
||||
this.isOnline = true; |
|
||||
return value; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
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); |
|
||||
} |
|
||||
} |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 125 KiB |