mirror of
https://github.com/luoyan35714/OPC_Client.git
synced 2026-04-18 00:01:30 +08:00
Change the Perf async test
This commit is contained in:
@@ -17,8 +17,8 @@ import org.openscada.opc.dcom.da.OPCSERVERSTATUS;
|
||||
import org.openscada.opc.dcom.da.impl.OPCServer;
|
||||
|
||||
/**
|
||||
* »ñÈ¡ServerµÄStatusÐÅÏ¢
|
||||
* ÖÐÎÄ
|
||||
* »ñÈ¡ServerµÄStatusÐÅÏ¢ ÖÐÎÄ
|
||||
*
|
||||
* @author Freud
|
||||
*
|
||||
*/
|
||||
@@ -39,6 +39,7 @@ public class DCOMTest1 {
|
||||
final IJIComObject serverObject = comServer.createInstance();
|
||||
|
||||
OPCServer server = new OPCServer(serverObject);
|
||||
|
||||
dumpServerStatus(server);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DCOMTest5 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
JISystem.setAutoRegisteration(true);
|
||||
|
||||
|
||||
/**
|
||||
* Session获取
|
||||
*/
|
||||
|
||||
@@ -7,9 +7,6 @@ import static com.freud.opc.utgard.BaseConfiguration.CONFIG_PASSWORD;
|
||||
import static com.freud.opc.utgard.BaseConfiguration.CONFIG_USERNAME;
|
||||
import static com.freud.opc.utgard.BaseConfiguration.getEntryValue;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jinterop.dcom.common.JIException;
|
||||
import org.jinterop.dcom.common.JISystem;
|
||||
import org.jinterop.dcom.core.IJIComObject;
|
||||
@@ -54,7 +51,7 @@ public class DCOMTest6 {
|
||||
0.0f, 1033);
|
||||
|
||||
final OPCItemIO itemIO = server.getItemIOService();
|
||||
queryItems(itemIO, "Saw-toothed Waves.Int");
|
||||
queryItems(itemIO, "Saw-toothed Waves.Int1");
|
||||
|
||||
// clean up
|
||||
server.removeGroup(group, true);
|
||||
@@ -62,10 +59,12 @@ public class DCOMTest6 {
|
||||
|
||||
public static void queryItems(final OPCItemIO itemIO, final String... items)
|
||||
throws JIException {
|
||||
final List<IORequest> requests = new LinkedList<IORequest>();
|
||||
for (final String item : items) {
|
||||
requests.add(new IORequest(item, 0));
|
||||
final IORequest[] requests = new IORequest[items.length];
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
requests[i] = new IORequest(items[i], 0);
|
||||
}
|
||||
itemIO.read(requests.toArray(new IORequest[0]));
|
||||
|
||||
itemIO.read(requests);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,16 +66,16 @@ public class DCOMTest7 {
|
||||
OPCGroupStateMgt group = server.addGroup("test", true, 100, 1234, 60,
|
||||
0.0f, 1033);
|
||||
|
||||
testItems(server, group, new String[] { "Saw-toothed Waves.Int2" });
|
||||
testItems(group, new String[] { "Saw-toothed Waves.Int2" });
|
||||
|
||||
// clean up
|
||||
server.removeGroup(group, true);
|
||||
|
||||
}
|
||||
|
||||
public static void testItems(final OPCServer server,
|
||||
final OPCGroupStateMgt group, final String... itemIDs)
|
||||
throws IllegalArgumentException, UnknownHostException, JIException {
|
||||
public static void testItems(final OPCGroupStateMgt group,
|
||||
final String... itemIDs) throws IllegalArgumentException,
|
||||
UnknownHostException, JIException {
|
||||
final OPCItemMgt itemManagement = group.getItemManagement();
|
||||
final List<OPCITEMDEF> items = new ArrayList<OPCITEMDEF>(itemIDs.length);
|
||||
for (final String id : itemIDs) {
|
||||
|
||||
@@ -55,6 +55,5 @@ public class DumpDataCallback implements IOPCDataCallback {
|
||||
public void writeComplete(final int transactionId,
|
||||
final int serverGroupHandle, final int masterErrorCode,
|
||||
final ResultSet<Integer> result) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.openscada.opc.lib.list.Category;
|
||||
import org.openscada.opc.lib.list.ServerList;
|
||||
|
||||
/**
|
||||
* 获得Server上所有的OPC连接信息
|
||||
* Get all the opc connection info from Server
|
||||
*
|
||||
* @author Freud
|
||||
*
|
||||
@@ -27,7 +27,7 @@ public class OPCTest1 {
|
||||
getEntryValue(CONFIG_USERNAME), getEntryValue(CONFIG_PASSWORD),
|
||||
getEntryValue(CONFIG_DOMAIN));
|
||||
|
||||
/** 通过ProgId获得ClsId,然后获得ClassDetail */
|
||||
/** According the progid get the clsid, then get the classdetail */
|
||||
// final String cls = serverList
|
||||
// .getClsIdFromProgId("Matrikon.OPC.Simulation.1");
|
||||
//
|
||||
|
||||
@@ -12,7 +12,9 @@ import org.openscada.opc.lib.da.browser.Leaf;
|
||||
import com.freud.opc.utgard.BaseConfiguration;
|
||||
|
||||
/**
|
||||
* 通过ClsId定位到连接,并将连接下的所有Group和Item打印
|
||||
*
|
||||
* According the clsid get the connection and print all the group and item
|
||||
* information
|
||||
*
|
||||
* @author Freud
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user