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