Utgard是什么
官方网站http://openscada.org/projects/utgard/
utgard是一个开源的项目,基于j-interop做的,用于和OPC SERVER通讯。
j-interop是纯java封装的用于COM/DCOM通讯的开源项目,这样就不必使用JNI
Utgard使用
- 依赖的jar包
j-interop.jar | 与COM和DCOM通讯的开源项目 |
---|---|
j-interopdeps.jar | |
jcifs-1.2.19.jar | |
org.openscada.opc.dcom-1.1.0-20141118.151415-27.jar | Utgard dcom的jar包 |
org.openscada.opc.lib-1.1.0-20141118.151453-1.jar | Utgard opc的jar包 |
slf4j-api-1.7.6.jar | Log4j依赖的jar包 |
log4j-1.2.16.jar | Log4j的jar包 |
Utgard与opc通讯分为两种方式
- Utgard OPC的API
- Utgard DCOM的API
示例代码参见
关键API示例
- 列举某Server下的所有OPC连接
1 | ServerList serverList = new ServerList("10.1.5.123", "freud", |
- 列举连接下的所有Group和Item
1 | public static void main(String[] args) throws Exception { |
- Item的同步查询
1 | public static void main(String[] args) throws Exception { |
- Item的异步查询
1 | private static final int PERIOD = 100; |
- Item的发布订阅查询
1 | private static final int PERIOD = 100; |
- 自动重连Item异步读取
1 | private static final int PERIOD = 100; |
- Item同步写入
1 | public static void main(String[] args) throws Exception { |
- Item异步写入