public class OPCClient extends Object
The OPC DA service is assumed to be running under Windows 7 or 10, which must have its DCOM permissions and firewall configured to allow remote access to the service. The j-interop library used to communicate with the service doesn't support Kerberos, and so can't pass along existing Kerberos credentials. This requires you to provide a username and password valid on the machine running the service. SLAC policy requires that you create a local account on that machine solely for this purpose so that the password is not valid except on that machine.
| Constructor and Description |
|---|
OPCClient(String serverName,
String domain,
String classID,
String username,
String password)
Establishes a connection to the OPC DA service.
|
| Modifier and Type | Method and Description |
|---|---|
OPCClient |
close()
Closes the connection to the service.
|
List<OPCItem> |
getData()
Gets the data read by the last call to readGroup().
|
Optional<Throwable> |
getException()
Gets the exception, if any, that stopped the last group read.
|
boolean |
isOpen()
Tells whether the connection to the service is still open.
|
OPCClient |
readGroup(boolean forceUpdate)
Reads all the values in the group.
|
OPCClient |
setGroup(List<String> itemNames)
Creates the group of data items to be read.
|
public OPCClient(String serverName, String domain, String classID, String username, String password) throws org.lsst.ccs.drivers.commons.DriverException
serverName - The hostname or IPv4 address of the server machine.domain - The Windows domain to which the user name belongs. Must be local to the
machine running the server.classID - The class ID (CLSID) of the OPC DA service.username - The remote username used to log in to the server.password - The password used to log in to the server.org.lsst.ccs.drivers.commons.DriverException - if the connection can't be made.public OPCClient setGroup(List<String> itemNames) throws org.lsst.ccs.drivers.commons.DriverException
itemNames - A list of the item names.org.lsst.ccs.drivers.commons.DriverException - if the operation failed.public OPCClient readGroup(boolean forceUpdate)
forceUpdate - If true causes the service to re-read each value from its device rather
than returning a cached value.public List<OPCItem> getData()
OPCItem.public Optional<Throwable> getException()
public boolean isOpen()
public OPCClient close()
Copyright © 2017 LSST. All rights reserved.