提交 | 用户 | 时间
|
71e81e
|
1 |
package cn.stylefeng.guns.plcserver.server.OP070.callback; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.plcserver.opc.GlobalVariable; |
|
4 |
import org.jinterop.dcom.common.JIException; |
|
5 |
import org.jinterop.dcom.core.JIVariant; |
|
6 |
import org.openscada.opc.lib.da.DataCallback; |
|
7 |
import org.openscada.opc.lib.da.Item; |
|
8 |
import org.openscada.opc.lib.da.ItemState; |
|
9 |
|
|
10 |
public class DataCallBack_OP070_J_PC_READ_INFO implements DataCallback { |
|
11 |
@Override |
|
12 |
public void changed(Item item, ItemState itemState) { |
|
13 |
|
|
14 |
// 读取变量的值 |
|
15 |
try { |
|
16 |
if (itemState.getValue().getType() == JIVariant.VT_BOOL) { |
|
17 |
boolean value = itemState.getValue().getObjectAsBoolean(); |
|
18 |
GlobalVariable.OP070_J_PC_READ_INFO = value; |
|
19 |
} |
|
20 |
} catch (JIException e) { |
|
21 |
e.printStackTrace(); |
|
22 |
} |
|
23 |
} |
|
24 |
} |